0

Hi my problem is that I have a slider that is triggered on an onlick event, on document ready. In all other browsers this works great. However in IE, you click the link and it turns to visited, then click it again and it works. After this it works first time all the time, it only seems to do this on first view of a the page, hence refreshing the page causes the problem again. I am really stuck on this one :(

This is the jQuery:

$(document).ready(function() {
	$('#bottomright a').click(function() {
		
		var $left = $('#content .inner2');
		$left.animate({
			marginLeft: parseInt($left.css('marginLeft'),10) == 0 ?
					$left.outerWidth() :
						0
		});
		
	});
	
	return true;
});
2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by @developer
0

Hi mikulucky,

It seems the IE assigns 'Auto' as the default margin for the div. You could set the default margin-left as 0. The script would look like.

$(document).ready(function() {
var $left = $('#content .inner2');
	$left.css('marginLeft',0);
	
	$('#bottomright a').click(function() {
		$left.animate({
			marginLeft: parseInt($left.css('marginLeft'),10) == 0?$left.outerWidth():0
		});
	});
	return true;
});

Hope that works.

Cheers :)

Edited by @developer: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.