Open kobiak opened 8 years ago
I am experiencing the same issue.
This is what triggers the bug for me
responsive: [{ //any code }]
I am experiencing the 'lazyLoaded'/'lazyLoadError' events being triggered multiple times, as well.
Looking at https://github.com/kenwheeler/slick/blob/master/slick/slick.js#L1616, it will nearly always (or always?) lazy load the first slide twice.
For me, double lazy loading happens with every slide, not just the first one. If I remove 'responsive' property from the options lazyload will fire correctly.
In my case only fires twice for local images. That is for images relative to site domain. Images from external sources are loaded correctly.
Setting / unsetting responsive
option had no effect.
It's becasue slick first create img element in JS
imageToLoad = document.createElement('img');
then is listening his onload event - (when fired image is loaded first time)
imageToLoad.onload = function() {
then it puts it in image src attribute in DOM (image load event two)
image.attr('src', imageSource)
You should not bother to much because after first onload event image should be cached by browser so second time is just displayed from cache.
However would be nice to have it fixed.
Do we have solution for it?
Yes, ignore it.
Pon., 27 wrz 2021, 20:19 użytkownik Preethy Borrawar < @.***> napisał:
Do we have solution for it?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kenwheeler/slick/issues/2520#issuecomment-928154769, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJJJO7THFNQ4IKB7E2QIPLUECYR7ANCNFSM4CQIZFFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
What is the solution could you please share having same issues
When lazy load images, and there's one slide with infinite: false. Lazyloaded callback is fired 2 times.
It works perfectly when there're 2 slides or more.
http://codepen.io/kobiak/pen/qaagpP
Steps to reproduce the problem
What is the expected behaviour?
To fire lazyloaded only once
More Details