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;
});

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 :)

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.