Closed ZCweb closed 6 years ago
It looks like Lozad uses a data-src
attribute to create the src
attribute as the element is scrolled to. Nothing comes to mind why this can't work with ScrollReveal.
Have you tried something like this?
const options = { scale: 0.9, duration: 1200 };
const observer = lozad(".lozad", {
rootMargin: "300px 0px",
loaded: function(el) {
sr.reveal(el, options);
}
});
observer.observe();
Scroll Reveal is great and I can get that working. I am doing some fade in things and elements that come in from the sides. I also have lazy loading working via the popular lozad plugin. My issue is that lozad doesn't work if scrollreveal is activated. Is this because how can something lazyload in if it is going to be animated in. It would be great if the 2 could work together and lozad is very popular so I have high hopes this could work.
A typical scroll reveal:
A typical lozad function ( https://github.com/ApoorvSaxena/lozad.js?files=1 )
Environment