Skip to content
New issue

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

Using Modernizr to detect webp support breaks pinning #42

Open
kmh3785 opened this issue Apr 6, 2015 · 0 comments
Open

Using Modernizr to detect webp support breaks pinning #42

kmh3785 opened this issue Apr 6, 2015 · 0 comments

Comments

@kmh3785
Copy link

kmh3785 commented Apr 6, 2015

When working properly, a pinned div would look something like:

Today, I was experimenting with webp images and using Modernizr to switch out between standard images/webp based on browser functionality, and found that it broke the pinning functionality - the same div now looks like:

This is the bit of script being used to switch images out

Modernizr.on('webp', function (result) {
// result == Modernizr.webp
console.log(result); // either true or false
if (result) {
// WebP Support
$(".webpImage").queue(function() {
var webp = $(this).attr('data-webp');
$(this).attr('src', webp)
})
}
else {
// No WebP support
$(".webpImage").queue(function() {
var nowebp = $(this).attr('data-img-fallback');
$(this).attr('src', nowebp)
})
}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant