Expose a function to load specific images before they appear
See original GitHub issueIt would be useful to be able to preload certain images in advance when certain events are triggered (say, a menu is opened). Currently, though, the load
function is not exported from the module. It would be useful to reuse it instead of having to write it by yourself.
The only issue I see is that the load
function is configurable. Although I suppose, we could assign it to the lozad
object.
Example:
import lozad from 'lozad'
const observer = lozad()
observer.observe()
document.addEventListener('menu:open', () => {
observer.load('img.language-icon')
})
Though observer.load
doesn’t sound right.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Javascript - execute after all images have loaded
Once all the images are loaded, your console will show "All images ... this is safe to expose to the caller. return when.all(deferreds); ......
Read more >Five Ways to Lazy Load Images for Better Website ...
Lazy loading images means loading images on websites asynchronously — that is, after the above-the-fold content is fully loaded, or even ...
Read more >So, You Want To Pre-Load, Huh?
The primary reason that you would want to pre-load images would be to increase responsiveness, as in, decrease noticeable time lags.
Read more >JavaScript Tutorial | Detect when images or the page has loaded
By using the " load " event within JavaScript, you are able to detect when the web page or images, scripts etc. have...
Read more >Lazy Loading Images – The Complete Guide
Lazy Loading Techniques for images. Images on a webpage can be loaded in two ways - using the <img> tag, or using the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
thanks for getting this done all the way @thiamsantos
I just opened a pull request adding this feature