猿问

我做了图片新闻滚动有个bug

<html>

<head>

<script src="jquerylayout.js" type="text/javascript"></script>

<style>

.ul01{margin:0 10px 0 0;padding:0;list-style:none;position:relative;right:0px;top:-30px;float:right;}

li{float:right;margin-left:5px;}

.a01{display:block;background:#ccc;width:20px;height:20px;text-align:center;}

.a01:hover,.a01:focus,.a01:active{background:#c22;}

.div01{height:2000px;}

.div01 div{width:1000px;height:1000px;border:2px solid #f00;position:relative;left:100px;top:100px;overflow:hidden;}

img{display:none;width:1000px;height:800px;}

</style>

<script>

var x=0;

function abc()

{   

    var node1=$("#div02").children("img");

    for(var i=0;i<$("#div02").children("img").length;i++){

if(i!=x)

{$("#div02").children("img:eq("+i+")").hide();

$(".a01:eq("+(node1.length-i-1)+")").css({"background":"#ccc"});

}

else

{$("#div02").children("img:eq("+i+")").show();

$(".a01:eq("+(node1.length-i-1)+")").css({"background":"#c22"});

}

}

if(x<($("#div02").children("img").length-1)){x=x+1;}

else{x=0;}

}

$(function(){

$("#div02").children(":eq(0)").show();

var node1=$("#div02").children("img");

$("#div02").append("<ul class='ul01'></ul>")

for(var i=node1.length;i>0;i--){

$(".ul01").append("<li><a class='a01' href='javascript:bannermenu("+i+");'>"+i+"</a></li>");

}

$(".a01").each(function(index)

{

$(".a01:eq("+index+")").mouseover(function(){x=node1.length-index-1;abc();clearInterval();clearInterval(time02);});

$(".a01:eq("+index+")").mouseout(function(){var time02=setInterval("abc()",3000);});

})

var time01=setInterval("abc()",3000);

})

</script>

</head>

<body>

<div class="div01">

<div id="div02"><img src="img01.jpg"><img src="img02.jpg"><img src="img03.jpg"></div>

</div>

</body>

</html>

bug是如果鼠标在右下角的图片小导航来回滑动,播放的速度就飞掉了.怎么办?

zhuxuehai2008
浏览 1437回答 1
1回答

zhuxuehai2008

clearInterval();我写的clearInterval(time01);还是不行
随时随地看视频慕课网APP
我要回答