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.

How to start autoplay just after loading the first image of the first slide?

See original GitHub issue

My Swiper is working really great with these setting:

var mySwiper = new Swiper ('.swiper-container', {

                pagination: '.swiper-pagination',
                paginationClickable: true,

                nextButton: '.swiper-button-next',
                prevButton: '.swiper-button-prev',

                // AutoPlay
                autoplay: 10000,
                speed: 1500,
                watchSlidesProgress: true,
                watchVisibility: true,

                // Loop
                loop: true,
                loopAdditionalSlides: 2,
                loopedSlides: 2,

                // Position
                slidesPerView: 'auto', //If "auto" or slidesPerView > 1, enable watchSlidesVisibility for lazy load
                spaceBetween: 20,

                // Keyboard and Mousewheel
                keyboardControl: true,
                mousewheelControl: true,
                mousewheelForceToAxis: true, // just use the horizontal axis to 

                // Lazy Loading 
                watchSlidesVisibility: true,
                preloadImages: false,
                lazyLoading: true,

            })

My question is if it’s possible to make the autoplay start just after the first image i loaded?

I realizes that if the internet is slower the slide changes with a empty div, which is not so nice…

Anyway, i am amazed with Swiper! thank you foe such a great plugin! ❤️

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
TeroBlaZecommented, Jun 7, 2018

This is for current api

    new Swiper('.slider', {
            /** your params **/
            on: {
                lazyImageReady: function () {
                    if (!this.autoplay.running) {
                        this.params.autoplay = {
                            delay: 4000,
                            disableOnInteraction: true
                        };
                        this.autoplay.start();
                    }
                }
            }
        });
1reaction
nolimits4webcommented, Mar 30, 2015

Reading docs could be really useful, look at parameters of this callback, compare loaded slide index with something. For example:

onLazyImageReady: function (s, slide) {
  if (!s.params.autoplay && $(slide.index()) === s.activeIndex) {
    s.params.autoplay = 10000;
    s.startAutoplay();
  }
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to start autoplay just after loading the first image ... - GitHub
My Swiper is working really great with these setting: var mySwiper = new Swiper ('.swiper-container', { pagination: '.swiper-pagination', ...
Read more >
Wait for slider to come into view before autoplay - General
Neither the Scroll or Slider triggers seem to affect autoplay. OK, here's a hack: Set the slider to display none on initial appearance,...
Read more >
Play a video automatically in a slide show - Microsoft Support
In Normal view, click the video in your slide. Under Video Tools, click the Playback tab. Next to Start, click the down arrow,...
Read more >
How to video slider auto play when first one is finish
Here is my solution. Just update the way we handle play, pause, ended events. And use another way to manage slide.
Read more >
Auto-play a PowerPoint presentation | Microsoft - YouTube
With Microsoft PowerPoint, you can use a self-running presentation to run unattended in a booth or kiosk at a trade show or convention, ......
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