Skip to content

Instantly share code, notes, and snippets.

@surjithctly
Created August 26, 2015 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save surjithctly/df90cc32f230b0f8251c to your computer and use it in GitHub Desktop.
Save surjithctly/df90cc32f230b0f8251c to your computer and use it in GitHub Desktop.
Retina Images JQuery @2x Replace
/* 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