我有此标记为背景图像:jquery的褪色为背景图像
<img src="bg.jpg" id="bg" alt="">
和此CSS:
#bg { position: fixed; top: 0; left: 0; }
#bg {display:none;}
和这个jQuery:
$(document).ready(function(){
$('#bg').load(function() {
$(this).fadeIn('slow');
});
});
基本上它工作,但奇怪的情况是,有时图像加载,有时不,有时我必须刷新页面几次。 看看here看看我在说什么。
它每次在Firefox 6.0.1上都能正常工作。 –
看看这个:http://stackoverflow.com/questions/1700864/making-images-fade-in-on-image-load-using-jquery –
可以试试$(window).load()...但那么会出现bg的闪光。 – Chris