Created
August 26, 2015 13:45
-
-
Save surjithctly/df90cc32f230b0f8251c to your computer and use it in GitHub Desktop.
Retina Images JQuery @2x Replace
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
/* retina | |
--------- */ | |
if (window.devicePixelRatio > 1){ | |
$(".retina").imagesLoaded(function(){ | |
$(".retina").each(function(){ | |
var src = $(this).attr("src").replace(".","@2x."); | |
var h = $(this).height(); | |
var w = $(this).width(); | |
$(this).attr("src",src).css({height:h,width:'auto'}); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment