ApoorvSaxena / ApoorvSaxena/lozad.js
Reloaded elements are not loaded lazily
- Vorherrschende Sprache
- JavaScript
- Sterne
- 7.5k
- Forks
- 435
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
## 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.
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.