New to jQuery, still learning a lot so I'm sorry if this is a silly question!
I'm able to Trigger a click, but I'd like to run the function over and over again so my carousel keeps rotating itself.
How would I do that?
Here's what I have so far:
setTimeout(function(){
$('.next').trigger('click');
}, 500);
Thanks!
You can do this by replacing setTimeout
with setInterval
to keep repeating the click after the specified timeout.
setInterval(function(){
$('.next').trigger('click');
}, 500);
Fair warning, while this will work, it's a terrible solution . It would be better to look for an API in your carousel, or add one to trigger a slide.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.