You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

55 lines
1.3 KiB

(() => {
// 获取屏幕大小
const getScreen = () => {
const width = window.innerWidth;
const height = window.innerHeight;
document.body.style = `
--width:${width}px;
--height:${height}px;
`;
}
getScreen()
// 监听屏幕变化
window.addEventListener('resize', getScreen);
// 加载loading
let publicLoading = document.getElementById('loading');
let publicWidth = 0;
let publicTimerID = null;
publicTimerID = setInterval(() => {
if (publicWidth > 99) {
clearInterval(publicTimerID);
return;
};
publicWidth += 1;
publicLoading.style.width = `${publicWidth}%`;
}, 100);
// ios 禁用屏幕缩放
document.documentElement.addEventListener(
"touchstart",
function (event) {
if (event.touches.length > 1) {
event.preventDefault();
}
},
false
);
var lastTouchEnd = 0;
document.documentElement.addEventListener(
"touchend",
function (event) {
var now = Date.now();
if (now - lastTouchEnd <= 300) {
event.preventDefault();
}
lastTouchEnd = now;
},
false
);
document.addEventListener("gesturestart", function (event) {
event.preventDefault();
});
})()