-
-
Save Offroadcode/2479366 to your computer and use it in GitHub Desktop.
highsrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A very mini jQuery highsrc plugin | |
// | |
// By Zach Inglis, edited by Pete Duncanson to make HTML5 friendly ish | |
// | |
// Example: | |
// <img src="logo.png" data-highsrc="logo.svg" /> | |
// | |
$(document).ready(function () { | |
if ( window.devicePixelRatio && window.devicePixelRatio > 1.5 ) { | |
jQuery("img[data-highsrc]").each(function() { | |
$(this).attr('src', $(this).attr('data-highsrc')); | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment