Created
June 8, 2016 01:46
-
-
Save martindrapeau/789c250bfcfda7407a681bf45ebde22f to your computer and use it in GitHub Desktop.
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
var screenWidth = Math.max(window.screen.width * window.devicePixelRatio, window.innerWidth); | |
var factor = screenHeight >= 960 ? 2 : 1; | |
if (screenHeight >= 960*2) factor = 3; | |
if (screenHeight >= 960*2.5) factor = 4; | |
// Image urls are then modified to load the proper size: | |
imgUrl.replace(".png", factor + ".png"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment