Skip to content

Instantly share code, notes, and snippets.

@panoply
Created August 15, 2015 16:35
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 panoply/d41383cd229d2c02e01f to your computer and use it in GitHub Desktop.
Save panoply/d41383cd229d2c02e01f to your computer and use it in GitHub Desktop.
Tictail - Image src resize in mobile
// # Tictail Product Image resize
//
// Use on themes that dont use the "mobile optimized layout" feature on tictail.
// The code resizes the products <img src=""> to lower resolution images.
// When document is ready preform the following actions:
//
$(function () {
if (window.matchMedia("(max-width:768px)").matches) {
$('.lazy').attr('data-original',function(i,e){
return e.replace("size=500","size=300");
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment