新增手机端浏览模式

This commit is contained in:
2023-09-27 16:32:38 +08:00
parent c77257730c
commit 4356de36b3
11 changed files with 310 additions and 28 deletions

View File

@@ -9,11 +9,11 @@ loading.show = function (count) {
}
if (loading.showCount == 0) {
loading.index = layer.load()
loading.index = layer.load();
}
loading.showCount += count;
}
};
loading.hide = function (count) {
@@ -37,4 +37,26 @@ loading.hide = function (count) {
layer.close(loading.index);
}
}
};
const tools = {};
tools.checkMobile = function () {
var userAgentInfo = navigator.userAgent;
var mobileAgents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"];
var mobile_flag = false;
//根据userAgent判断是否是手机
for (var v = 0; v < mobileAgents.length; v++) {
if (userAgentInfo.indexOf(mobileAgents[v]) > 0) {
mobile_flag = true;
break;
}
}
var screen_width = window.screen.width;
var screen_height = window.screen.height;
//根据屏幕分辨率判断是否是手机
if (screen_width < 600 && screen_height < 800) {
mobile_flag = true;
}
return mobile_flag;
};