Created
February 25, 2014 11:48
-
-
Save sandywu/9207474 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
define(['zepto'], function() { | |
function getDevicePixelRatio() { | |
return window.devicePixelRatio ? window.devicePixelRatio : 1; | |
} | |
function getImageSize() { | |
if(window.__NETWORK_STATUS__ == 3) { | |
return "_80x80Q90.jpg"; | |
} | |
var dpr = Number(getDevicePixelRatio()); | |
if (dpr == 1) { | |
return "_120x120Q90.jpg"; | |
} else if (dpr == 1.5 || dpr == 1.3) { | |
return "_180x180Q90.jpg"; | |
} else if (dpr >= 2) { | |
return "_240x240Q90.jpg"; | |
} | |
} | |
return { | |
'getImageSize': getImageSize | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment