ApoorvSaxena / ApoorvSaxena/lozad.js

Load Next slide Image in a carousel while on current slide using lozad. (load n+1th slide while on nth slide)

Ouverte
#283 1 commentaire 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

I'm currently using lozad in a carousel and it works fine but to improve performance I need the image of the immediate next slide in carousel to load while on current slide.

Tried changing values of root margin but it still loads image once that slide is on viewport.

-------------------------------------
var observer = lozad('.lozad', {
threshold: 0,
rootMargin: '600px'
})
observer.observe();
------------------------------------
As you can see root margin with 600px is working fine vertically but not horizontally.

Images are loading vertically when they are 600px away from viewport but not horizontally in carousel.

In carousel the image is loading only when we move to next slide which will affect the performance.

Do I have to set root property as well? if so what can be the value? Because I tried giving it null, doesn't work.

how can I get the intersection observer to work on x-axis as well.

Am I missing something or Is there any way to modify root margin so that in carousel while I'm on "nth slide, n+1th slide" be loaded for smooth transition in carousel.

@ApoorvSaxena

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.