向现有的 JS 滑块添加计时器 [英] Adding a timer to existing JS slider

查看:54
本文介绍了向现有的 JS 滑块添加计时器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望有人能指出我正确的方向.
我正在为客户建立一个在线商店并使用 PrestaShop Moon 主题 (链接).您会在演示中注意到有一个滑块.但是,滑块不会像其他一些滑块那样每隔几秒自动更改一次(例如这个 one).Moon 主题使用由 Brian Reindel 创建的旧滑块,不再受支持.

Hoping someone can point me in the right direction.
I'm building a online shop for a client and am using the PrestaShop Moon theme (link). You'll notice in the demo that there is a slider. However, the slider doesn't change automatically every few seconds like some sliders out there (for example this one). The Moon theme uses an old slider created by Brian Reindel which is no longer supported.

主题滑块也调用 boot.js,其中只包含.

The themes slider also calls boot.js which only includes.

$(function() {

    $( "#slides" ).accessNews({
        speed : "normal",
        slideBy : 1
    });


});

所以我的问题是采用现有的 .js 是否可以修改为自动滑动?

So my question is taking the existing .js can it be modified to auto-slide?

感谢大家的帮助!

推荐答案

是的,只需设置一个间隔并在滚动的箭头上调用click"事件.它应该如下所示:

Yes, just set an interval and invoke the "click" event on the arrow that scrolls. It should look something like the following:


function makeScroll() {
 $('#arrow').click();
}

setInterval(makeScroll, secs*1000);

其中 secs 是您想要延迟的秒数

where secs is the num of secs you want delayed

这篇关于向现有的 JS 滑块添加计时器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆