ApoorvSaxena / ApoorvSaxena/lozad.js
Reloaded elements are not loaded lazily
- Lingua principale
- JavaScript
- Stelle
- 7.5k
- Fork
- 435
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
## Expected Behavior
When `enableAutoReload=true` and a data attribute changes on an element that had been previously loaded, the element should not be reloaded until it is in the viewport.
## Current Behavior
When the element's data attribute changes, lozad immediately reloads the element even when not in the viewport.
## Possible Solution
The mutation callback could check if the element is visible. If it is, it calls `load` as it does currently. Otherwise, it sets the `data-loaded` attribute to false.
## Steps to Reproduce (for bugs)
1. Create a new lozad observer with `enableAutoReload: true`
2. Lazy load an image by moving it on screen
3. Move the image off screen
4. Change the `data-src` attribute on the element
5. Notice that the `src` attribute has changed on the element despite not being in the viewport.
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.