简体   繁体   English

如何向此滑块添加自动播放

[英]How to add autoplay to this slider

i'm begginer with java so i used this slider code and I want to add an autoplay option but i juct can't get it right. 我是Java初学者,所以我使用了此滑块代码,我想添加一个自动播放选项,但我认为无法正确执行。 Here is the slider i'm using as an example http://rafbm.github.io/howtomakeaslider/demo.html 这是我用作示例的滑块http://rafbm.github.io/howtomakeaslider/demo.html

Thank you 谢谢

You could use the setInterval() . 您可以使用setInterval() Put this at the end of the document 将其放在文档末尾

setInterval(function(){
      goToNext();
    },5000);

The goToNext() function is attached to your "next" button. goToNext()函数已附加到“下一步”按钮。 The above function will trigger it every 5 seconds. 以上功能每5秒触发一次。

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

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