We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I installed lozad by npm.
I created plugin lozad.js.
import Vue from 'vue'; import lozad from 'lozad'; let observer = lozad('.lozad', { threshold: 0 }); Object.defineProperty(Vue.prototype, '$lozad', { value: observer });
In container mounted lifecycle called function:
mounted() { this.$lozad.observe();
I want use lozad with picture tag.
<picture class="lozad"> <source srcset="https://nuxtjs.org/logos/nuxt.svg" media="(min-width: 751px)" > <source srcset="https://vuejs.org/images/logo.png" media="(min-width: 320px)" > <img src="https://apoorv.pro/lozad.js/banner/lozad-banner.jpg" /> </picture>
Why my placeholder image from img tag did not load, instead, the image from the first source.
The text was updated successfully, but these errors were encountered:
const observer = lozad(this.$el.querySelector('picture.lozad'), { rootMargin: '50px 0px', threshold: 0.1, load(el) { const sources = el.querySelectorAll('source') sources.forEach((source) => { source.setAttribute('srcset', source.getAttribute('data-srcset')) }) } }) observer.observe()
something like this made it work for me but i needed to change srcset attrib to data-srcset.
srcset
data-srcset
Sorry, something went wrong.
No branches or pull requests
I installed lozad by npm.
I created plugin lozad.js.
In container mounted lifecycle called function:
I want use lozad with picture tag.
Why my placeholder image from img tag did not load, instead, the image from the first source.
The text was updated successfully, but these errors were encountered: