Created
July 9, 2011 11:49
-
-
Save enovav/1073542 to your computer and use it in GitHub Desktop.
Mobile Images
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
if (screen.width < 480) { | |
var imgs = document.getElementsByTagName("img"); | |
for (var i = 0; i < imgs.length; i++) { | |
var elm = imgs[i]; | |
if (elm.getAttribute("data-src-mobile")) { | |
elm.setAttribute("src", elm.getAttribute("data-src-mobile")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment