2
我想要實現選取框效果,有時會順利,有時會出錯,不知道爲什麼。選取框效果無法正常工作
我的代碼:
$(document).ready(function(){
$(".menudepth1").children("a").click(function(){
$(this).addClass("selected")
})
function move(){
var Parent=$("#left-con").find("ul");
var Img=$("#left-con").find("li").eq(0);
var Width=Img.width();
Img.animate({marginLeft:(-1*Width)+"px"},2000,function(){
$(this).appendTo(Parent).css("marginLeft","0px");
})
}
setInterval(move,2000)
})
其工作在您的jsfiddle – chirag
您的間隔回調在動畫完成之前調用。這是一個簡單的修復,比使用任何間隔更好:https://jsfiddle.net/hpqxtdeq/2/在這裏,如果你想每個圖像幻燈片之間的一些延遲:https://jsfiddle.net/hpqxtdeq/3/ –