question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Auto play not working

See original GitHub issue

I’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:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
pat-sullivancommented, Aug 1, 2017

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.

1reaction
nolimits4webcommented, Nov 14, 2014

var swiper = new Swiper(…, {autoplay: 5000}); swiper.swipeNext(true, true); swiper.startAutoplay(); //just in case

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found