Skip to content

Instantly share code, notes, and snippets.

@Offroadcode
Forked from zachinglis/jquery.highsrc.js
Created April 24, 2012 12:48
Show Gist options
  • Save Offroadcode/2479366 to your computer and use it in GitHub Desktop.
Save Offroadcode/2479366 to your computer and use it in GitHub Desktop.
highsrc
// 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