开发者

AutoScrolling on Slider Gallery

开发者 https://www.devze.com 2023-03-08 12:26 出处:网络
i have this example of gallery, and i\'m new on jQuery. I want to know, if theres a way开发者_运维技巧 to implement an autoscrolling of this images....

i have this example of gallery, and i'm new on jQuery. I want to know, if theres a way开发者_运维技巧 to implement an autoscrolling of this images....

http://tympanus.net/Tutorials/SliderGallery/


lets say you have functions next() and prev() to scroll the images with the buttons. if you want to autoscroll, based on what you've written above, you would use a timer via the setTimeout function like so:

window.setTimeout(next, 5000);

This would scroll to the next image every 5 seconds. Now, if you're at the end of the gallery, you could write some logic to determine that and go back to the beginning or go in the reverse order.

However, Because there can be a logic involved in something like this, I would highly recommend using a third-party jQuery plug-in such as Nivo Slider...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号