我想从页面加载到关闭时随机淡入和淡出一些图像。我有什么用。css
#block{position:relative;top:100px;left:100px;}
HTML
<div id="block">
<img src="images/block/blockone.jpg"width="95"height="95">
<img src="images/block/blocktwo.jpg"width="95"height="95">
//Five images as such
</div>
剧本
function random(n){
return Math.floor(Math.random()*n);
var transition_time=500;
var waiting_time=500;
var images=$('div#block img');
var n=images.length;
var current=random(n);
images.hide();
images.eq(current).show();
var interval_id=setInterval(function(){
images.eq(current).fadeOut(transition_time,function(){current=random(n);
images.eq(current).fadeIn(transition_time);
});
},2*transition_time+waiting_time);
它不起作用,我真的很想听听你的建议