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.

lazyLoadingInPrevNextAmount not preloading images with lazy loading

See original GitHub issue

I’ve been trying to get the recently implemented lazyLoadingInPrevNextAmount option to work but so far it seems to have no effect.

I have tested this with the latest 3.3.1 version of Swiper and it still doesn’t work. I have set up an example here: http://codepen.io/anon/pen/gPQqGQ

If I open the Chrome inspector and watch the network tab, I can see only a couple of images are downloaded (ie. the ones that are in view). Then it just waits and no more images download. When I scroll, images are downloaded as they come into view but this is too late - I would like to have it always loading several images ahead to avoid the noticeable delay each time a new image appears.

Here is my configuration for reference:

var swiper = new Swiper('.swiper-container', {
                direction: 'horizontal',
                slidesPerView: 'auto',
                spaceBetween: 10,
                mousewheelControl: true,
                mousewheelSensitivity: 1,
                freeMode: true,
                preloadImages: false,
                lazyLoading: true,
                watchSlidesVisibility: true,
                lazyLoadingInPrevNext: true,
                lazyLoadingInPrevNextAmount: 5
            });

Is this a bug or am I doing something wrong? I saw a mention in other issue that someone else was having the same problem so I don’t think it’s just me.

Any help would be appreciated! This script is amazing and it’s so close to being perfect for what I need. Many thanks!

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
hybridvisioncommented, Mar 3, 2016

Hi Vladimir,

I was wondering if there is any update on this? I imagine you’ve got a lot on your todo list so no pressure, just hoping to get an idea of a possible timeframe since I’d like to use Swiper in a project that is launching soon.

Thanks!

1reaction
hybridvisioncommented, May 9, 2016

If anyone is looking for an alternative until this is implemented, check out the excellent Lazysizes plugin: http://afarkas.github.io/lazysizes/

Read more comments on GitHub >

github_iconTop Results From Across the Web

lazyLoadingInPrevNextAmount not preloading images with ...
I've been trying to get the recently implemented lazyLoadingInPrevNextAmount option to work but so far it seems to have no effect.
Read more >
Difference between preloading images and lazy loading images
I am wondering or not really understanding the use cases between preloading and the difference to lazy loading or smart lazy loading (load ......
Read more >
Browser-level image lazy loading for the web - web.dev
This post covers the loading attribute and how it can be used to control the loading of images.
Read more >
Lazy Loading Images – The Complete Guide - ImageKit.io
Lazy loading images that are not in the viewport improves initial page load performance and user experience. This is an in-depth guide to ......
Read more >
javascript - lazyload - preload adjacent images - Stack Overflow
As it is now, the lazyload function only loads the visible image (which then gets cached). The adjacent images are hidden underneath and...
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