锁定响应式设计的最小宽度

小于 480 等比缩放,大于 480 自适应布局。 不知道有什么用,大概只有在设计师和 pm 都没想好怎么响应式的时候,给临时没想到的细节作为善后用的吧!

function effectiveDeviceWidth() {
    var deviceWidth = window.orientation == 0 ? window.screen.width : window.screen.height;
    // iOS returns available pixels, Android returns pixels / pixel ratio
    // http://www.quirksmode.org/blog/archives/2012/07/more_about_devi.html
    if (navigator.userAgent.indexOf('Android') >= 0 && window.devicePixelRatio) {
        deviceWidth = Math.floor(deviceWidth / window.devicePixelRatio);
    }
    return deviceWidth;
}
var viewPortString = effectiveDeviceWidth() > 480 ?
'<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />'
: '<meta name="viewport" content="target-densitydpi=device-dpi,width=480,user-scalable=0" />';
document.write(viewPortString);