jquery实现轮播图效果

2020-05-23 06:14:50易采站长站整理

$(this).removeClass('active')
}).eq(curindex).addClass('active');
//auto slide
$imgWrap.animate({
'left': width*curindex*(-1)+'px',
}, speed)
//一开始没加"timer = ",这个bug耽误了不少时间
timer = setTimeout(move,duration+speed);
};
//init
timer = setTimeout(move,duration);
//click event
$('#slideshow-nav>span').on('click', function(event) {
event.preventDefault();
/* Act on the event */
clearTimeout(timer);
$imgWrap.stop(true, true);
curindex = $(this).index() - 1;
move();
});
})
</script>
</body>
</html>