ApoorvSaxena / ApoorvSaxena/lozad.js

Reloaded elements are not loaded lazily

Ouverte
#251 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
7.5k
Forks
435
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

## 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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.