(function (doc, win) { var docel = doc.documentelement, resizeevt = 'orientationchange' in window ? 'orientationchange' : 'resize', recalc = function () { let clientwidth1 = docel.clientwidth; // alert(clientwidth1) if (!clientwidth1) return; if (clientwidth1 <= 1024) { docel.style.fontsize = 100 * (clientwidth1 / 750) + 'px'; } else { docel.style.fontsize = 100 * (clientwidth1 / 1920) + 'px'; } // if (clientwidth1 <= 1024) { // docel.style.fontsize = 100 * (clientwidth1 / 750) + 'px'; // } else if (clientwidth1 > 1024 && clientwidth1 <= 1920) { // docel.style.fontsize = 100 * (clientwidth1 / 1920) + 'px'; // // console.log('1920') // } else if (clientwidth1 > 1920) { // docel.style.fontsize = 100 + 'px'; // // console.log('大于1920') // } }; if (!doc.addeventlistener) return; win.addeventlistener(resizeevt, recalc, false); doc.addeventlistener('domcontentloaded', recalc, false); })(document, window); var clientwidth = document.documentelement.clientwidth; $(document).ready(function () { // 顶部导航显示隐藏 var p = 0, t = 0; $(window).scroll(function () { p = $(this).scrolltop(); if (p > 200) { $('.header-wrap').addclass('headerbg') } else { $('.header-wrap').removeclass('headerbg') } if (t < p) { //下滚 // console.log('向下') if (p > 120) { $('.header-wrap').addclass('headerhide') } } else { //上滚 // console.log('向上'); $('.header-wrap').removeclass('headerhide') } settimeout(function () { t = p; }, 0) }) }) // //判断移动端设备 // function ismobile() { // if (navigator.useragent.match(/android/i) // || navigator.useragent.match(/webos/i) // || navigator.useragent.match(/iphone/i) // || navigator.useragent.match(/ipad/i) // || navigator.useragent.match(/ipod/i) // || navigator.useragent.match(/blackberry/i) // || navigator.useragent.match(/windows phone/i) // ) return 1; // return 0; // } // var clientwidth = document.documentelement.clientwidth; // settimeout(() => { // if (clientwidth <= 768 || ismobile() == 1) { // var metael = document.queryselector('meta[name="viewport"]'); // var scale = clientwidth / 1920; // metael.setattribute('content', 'width=device-width, initial-scale=' + .2); // console.log('设置移动端缩放比例', metael); // if (ismobile() == 1) { // // loadmobilecss(); // } // } // }, 0) // if (localstorage.getitem('testphone') == 'testphone') { // if (ismobile() == 1) { // alert('屏幕宽度' + clientwidth) // settimeout(() => { // loadvconsole(); // }, 3000) // } // }