Hi,
I have a div called #whatnewstoggler and it's width changes dynamically. This causes problems because I cannot centre this horizontally. The only way is to get the width and add inline css dynamically using jquery.
The js works in all browsers apart from IE6 and IE7. IE8 works fine.
I have narrowed the problem down to this line var totalOffset = halfslideshow - offset;
When I alert(''+ totalOffset +''); it gives me '0' but when I alert(''+ offset +''); it gives me the correct with before the final calculation.
Here is the code.
var halfslideshow = 312;
var width = $('#whatnewstoggler').width();
var offset = width / 2;
var totalOffset = halfslideshow - offset;
//alert(''+ totalOffset +'');
$('#whatnewstoggler').css('margin-left',totalOffset);
Thanks for your help!