简体   繁体   English

我怎样才能让这个滑块代码在 JavaScript 中自动播放?

[英]How can i make this slider code to autoplay in JavaScript?

Hello I'm trying to get this slider to auto play in Javascript, but I can't seem to get it to work, Does anyone know how I can achieve this?你好,我正在尝试让这个滑块在 Javascript 中自动播放,但我似乎无法让它工作,有谁知道我如何实现这一点?

I took the slider from here :从这里拿了滑块:

Here is the current code:这是当前的代码:

$(".button-next").click(function() {
    var e = $(".feature-slide.active");
    $(e).removeClass("active"), 
    $(e).next().addClass("active"), 
    $(".feature-slide").hasClass("active") || $(".feature-slide:first").addClass("active")
});
$(".button-prev").click(function() {
    var e = $(".feature-slide.active");
    $(e).removeClass("active"), $(e).prev().addClass("active"), $(".feature-slide").hasClass("active") || $(".feature-slide:last").addClass("active")
});

FYI: i'm not a developer, and obviously i'm not a javascript expert, so i'm trying to get help here because you are the experts, so if you are not going to give a positive response, restrain from answering or making negative comments, thanks!仅供参考:我不是开发人员,显然我不是 javascript 专家,所以我想在这里寻求帮助,因为您是专家,所以如果您不打算给出积极的回应,请不要回答或发表负面评论,谢谢!

Here is the code http://codepen.io/El-Oz/pen/qZQePV这是代码http://codepen.io/El-Oz/pen/qZQePV

if you want to change speed of slide you can increase/decrease the timer in JS code.如果你想改变幻灯片的速度,你可以在 JS 代码中增加/减少timer

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM