Auto play not working
See original GitHub issueI’m trying to start the slider playing immediately, but i can’t get it to work. I’ve tried with and without onFirstInit
callback.
var defaultData = {
mode: 'horizontal',
loop: true,
slidesPerView: 2,
roundLengths: true,
autoPlay:2000,
keyboardControl: true,
onFirstInit:function(swiper)
{
swiper.startAutoplay();
},
onInit: function (swiper) {
var num = ($(window).width() < 800) ? 2 : 4;
swiper.params.slidesPerView = num;
}
};
Also, unrelated, I’ve noticed that onInit
is fired on every window resize
event. You might want to optionally debounce that.
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
6 Fixes When the AutoPlay Isn't Working on Windows 11
1. Turn Off and On AutoPlay in the Settings · Press Win + I to open Settings. · Open the Bluetooth & devices...
Read more >Autoplay not working in Windows 10/11 [COMPLETE GUIDE]
1) Reset the Autoplay settings ; Press Windows Key + S and enter the Control Panel. Now select Control Panel from the list...
Read more >Video auto play is not working in Safari and Chrome desktop ...
I had this issue in Safari 11 where a background video (no audio) wouldn't play automatically. Adding muted and autoplay did the trick....
Read more >How to Fix Windows 10 AutoPlay Not Working? – 6 Methods
Sometimes, Windows 10 AutoPlay may not work. How to fix windows 10 autoplay not working issue? This video offers 6 methods. Method 1....
Read more >AutoPlay not working in Windows 11/10
AutoPlay not working on Windows 11/10 · Enable the AutoPlay feature again · Change Shell Hardware Detection service · Enable AutoPlay notification ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I know this is old, but in case anyone else finds themselves here. Change “autoPlay” to “autoplay” in the parameters, and it should fix the issue.
var swiper = new Swiper(…, {autoplay: 5000}); swiper.swipeNext(true, true); swiper.startAutoplay(); //just in case