tab优化

This commit is contained in:
zhanglipeng 2021-06-05 21:00:17 +08:00
parent 41bca98a3c
commit 5d045b62e9

View File

@ -57,22 +57,22 @@ export default {
}, },
}; };
// JavaScript Document // JavaScript Document
(function px2rem(doc, win) { // (function px2rem(doc, win) {
var docEl = doc.documentElement, // var docEl = doc.documentElement,
resizeEvt = "orientationchange" in window ? "orientationchange" : "resize", // resizeEvt = "orientationchange" in window ? "orientationchange" : "resize",
recalc = function () { // recalc = function () {
var clientWidth = docEl.clientWidth; // var clientWidth = docEl.clientWidth;
if (!clientWidth) return; // if (!clientWidth) return;
docEl.style.fontSize = 100 * (clientWidth / 750) + "px"; // docEl.style.fontSize = 100 * (clientWidth / 750) + "px";
}; // };
if (!doc.addEventListener) return; // if (!doc.addEventListener) return;
// // //
win.addEventListener(resizeEvt, recalc, false); // win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener("DOMContentLoaded", recalc, false); // doc.addEventListener("DOMContentLoaded", recalc, false);
setTimeout(function () { // setTimeout(function () {
px2rem(doc, win); // px2rem(doc, win);
}, 200); // }, 200);
})(document, window); // })(document, window);
</script> </script>
<style> <style>
body, body,