MCPcopy Create free account
hub / github.com/Xu22Web/tech-study-js / hasMobile

Function hasMobile

tech-study.js:2496–2507  ·  view source on GitHub ↗

* @description 判断是否为移动端 * @returns

()

Source from the content-addressed store, hash-verified

2494 * @returns
2495 */
2496function hasMobile() {
2497 let isMobile = false;
2498 if (navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
2499 log('移动端');
2500 isMobile = true;
2501 }
2502 if (document.body.clientWidth < 800) {
2503 log('小尺寸设备端');
2504 isMobile = true;
2505 }
2506 return isMobile;
2507}
2508/**
2509 * @description 等待时间
2510 * @param time

Callers 3

initFontSizeFunction · 0.70
handleSlideVerifyFunction · 0.70
PanelFunction · 0.70

Calls 1

logFunction · 0.70

Tested by

no test coverage detected