[英]Previous slide and auto play Jquery slider,
I`m trying to figure out how to make a jquery slider, I got 2 main problems. 我想弄清楚如何制作一个jquery滑块,我遇到了2个主要问题。
PROBLEM 1 Previous slide. 问题1上一张幻灯片。 Its going to the previous slide, but after clickCount == slider.length, it just disapears.
它转到上一张幻灯片,但是在clickCount == slider.length之后,它消失了。
//previous
$("#previous").click(function(){
if(clickCount < slider.length)
slider.eq(clickCount--).hide();
if(clickCount == slider.length)
clickCount = 0;
slider.eq(clickCount).show();
}) ;
PROBLEM 2 Auto Play My auto-play logic is not working... 问题2自动播放我的自动播放逻辑不起作用...
//autoplay
$(document).ready(function(){
var presentSlide = 0
if(presentSlide < slider.length)
slider.eq(presentSlide++).fadeOut(600);
if(presentSlide == slider.length)
presentSlide = 0;
slider.eq(clickCount).fadeIn(600);
}) ;
Problem 1: 问题一:
You have to check clickCount
different than the next
button: 您必须检查
clickCount
与next
按钮不同:
$("#previous").click(function(){
if(clickCount >= 0)
slider.eq(clickCount--).hide();
if(clickCount < 0)
clickCount = slider.length-1;
slider.eq(clickCount).show();
}) ;
Problem 2: 问题2:
For the auto-play, why don't you just click
the next
button every X seconds? 对于自动播放,为什么不每隔X秒
click
next
按钮?
$(document).ready(function(){
setInterval(function(){
$("#next").click();
},5000); //every 5000 ms (5 seconds)
}) ;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.