新币+dapp app 前端
zzzz
2024-04-09 eea1a497191396abc42f2c943a0b3b86f4b430ba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const baseSize = 16
function setRem() {
    const scale = document.documentElement.clientWidth / 828
    document.documentElement.style.fontSize = baseSize * scale + 'px'
}
function isMobile() {
    let userAgentInfo = navigator.userAgent;
    let Agents = ['Android', 'iPhone', 'SymbianOS', 'Windows Phone', 'iPad', 'iPod'];
    let getArr = Agents.filter(i => userAgentInfo.includes(i));
    return getArr.length ? true : false;
}
if (isMobile()) {
    setRem()
}
window.onresize = function () {
    if (isMobile()) {
        setRem()
    }
 
}