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 load a specific hidden image

See original GitHub issue

I have a slider on my site containing large images whereby only one slide is shown at a time. I would like to lazy load all the images in the slider using data-srcset. If I use the plugin “out of the box” the first slide is loaded correctly. Upon advancing to the next slide, the image is not loaded until I scroll the page a little. I have tried the following code but with no real success:

slickSlider.on('afterChange', function() {
    $('.slide.slick-active').next().find('img[data-srcset]').lazyLoadXT({visibleOnly: false, checkDuplicates: false, forceLoad: true});
});

In the above code I target the next slide and look for the image and apply lazyload… Perhaps I’m using the incorrectly. Can someone point me in the right direction.

Issue Analytics

  • State:open
  • Created 9 years ago
  • Comments:9

github_iconTop GitHub Comments

1reaction
dryabovcommented, Feb 27, 2015

Hmm, I guess

$.lazyLoadXT.updateEvent += ' afterChange';

or (if afterChange is a slider’s internal event)

slickSlider.on('afterChange', function() {
    $(window).trigger('scroll');
});

should work.

0reactions
MelchnerRomancommented, Jul 7, 2016

+1 for implemention in master

Read more comments on GitHub >

github_iconTop Results From Across the Web

Load hidden image to HTML - javascript - Stack Overflow
I do some actions with couple of images, but to work everything smoothly I need the browser to load the images. For example...
Read more >
How To Hide Files In a JPG Picture - Online Tech Tips
To unhide your files, right-click on the JPG image where your files are hidden, select Open with, and choose WinRAR archiver. You can...
Read more >
Prevent Loading Hidden Images - Tezify
The most intuitive approach to hide an image is to set it's display property to none. The problem with this is that even...
Read more >
Hide photos on your iPhone, iPad, or Mac - Apple Support
How to hide photos on iPhone or iPad · Open Photos. · Select the photo or video that you want to hide. ·...
Read more >
How To Add Photos to Hidden Album iOS 16! - YouTube
Amazon Daily Deals: http://saunders.gg/amazon❤️ If you enjoy this content, please consider a paid "super thanks" in the video or becoming ...
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