WebP detection with Modernizr
mokkab opened this issue · comments
mokkab commented
Hello,
I'm trying to get Jarralax to work on a website that uses Modernizr to detect WebP.
See https://css-tricks.com/using-webp-images/#aa-using-webp-images-in-css
.no-webp .elementWithBackgroundImage {
background-image: url("image.jpg");
}
.webp .elementWithBackgroundImage{
background-image: url("image.webp");
}
Jarralax works great on pages with jpg images but not on pages with webp backgrounds.
How to make this work?
Thanks!
Nikita commented
Hey.
You can init Jarallax manually using JS call (https://github.com/nk-o/jarallax#run-jarallax) right after Modernizr adds a .webp
classname.
Or use <picture>
tag (second example here - https://github.com/nk-o/jarallax#prepare-html) with an additional webp source.