Fade with caption message problem IE8 jquery
I have a problem with my fade with caption in jquery.. my problem is the following The rolling messages on the header run down into the body of the 开发者_开发问答page on IE8.
Please i left here the url.
http://www.aerocom.net.au/index.php?id=contact-us
Thanks in advance
That's probably because of this line (from aerocom.js), that sets the width of the caption:
$('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});
You're trying to get the width on the image on document ready, but that's before the image is loaded, and therefor the width is 0.
You can either get the width on window load, when the image has loaded:
$(window).load(function() {
$('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});
});
Or continue using document ready, and set a width on the img tag:
<img width="980" src="http://www.aerocom.net.au/theme/Default_Simple/image/banner/banner4.jpg">
I would recommend the former. I would also set an height. By doing this the browser can skip a few reflows when initially rendering the page, which means faster loading.
精彩评论