admin管理员组文章数量:1201647
I have a slideshow I'd like to auto play and loop continuously. I've found snippets that let me set a global slide duration and use impress.next() with a setInterval() call to move forward, but then I lose the ability to have different durations for each slide.
I have a slideshow I'd like to auto play and loop continuously. I've found snippets that let me set a global slide duration and use impress.next() with a setInterval() call to move forward, but then I lose the ability to have different durations for each slide.
Share Improve this question asked Jul 27, 2012 at 18:59 creativetimcreativetim 1,1382 gold badges13 silver badges26 bronze badges1 Answer
Reset to default 26I'm happy to share my solution. If you see room for improvement don't be shy. Hopefully this helps someone out there.
<script>
var impress = impress();
impress.init();
document.addEventListener('impress:stepenter', function(e){
if (typeof timing !== 'undefined') clearInterval(timing);
var duration = (e.target.getAttribute('data-transition-duration') ? e.target.getAttribute('data-transition-duration') : 2000); // use the set duration or fallback to 2000ms
timing = setInterval(impress.next, duration);
});
</script>
本文标签: javascriptHow to make impressjs slideshow auto play and loopStack Overflow
版权声明:本文标题:javascript - How to make impress.js slideshow auto play and loop - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738636307a2104055.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论