diff --git a/src/flexible.js b/src/flexible.js index 4e7c545..ed9ff7a 100644 --- a/src/flexible.js +++ b/src/flexible.js @@ -3,6 +3,8 @@ var docEl = doc.documentElement; var metaEl = doc.querySelector('meta[name="viewport"]'); var flexibleEl = doc.querySelector('meta[name="flexible"]'); + var maxWidthEl = doc.querySelector('meta[name="max-width"]'); + var maxWidth = 540; var dpr = 0; var scale = 0; var tid; @@ -31,6 +33,13 @@ } } + if (maxWidthEl) { + var maxWidthContent = maxWidthEl.getAttribute('content'); + if (maxWidthContent) { + maxWidth = parseInt(maxWidthContent); + } + } + if (!dpr && !scale) { var isAndroid = win.navigator.appVersion.match(/android/gi); var isIPhone = win.navigator.appVersion.match(/iphone/gi); @@ -67,8 +76,8 @@ function refreshRem(){ var width = docEl.getBoundingClientRect().width; - if (width / dpr > 540) { - width = 540 * dpr; + if (width / dpr > maxWidth) { + width = maxWidth * dpr; } var rem = width / 10; docEl.style.fontSize = rem + 'px'; @@ -114,4 +123,4 @@ return val; } -})(window, window['lib'] || (window['lib'] = {})); \ No newline at end of file +})(window, window['lib'] || (window['lib'] = {}));