检测是不是触摸设备(手机端移动端)

function isTouchDevice() {
    return 'ontouchstart' in document.documentElement;
}
if (isTouchDevice()) {
    // on Mobile
}
else {
    // on Desktop
}

猜你喜欢

转载自blog.csdn.net/wang_liuyong/article/details/81235132
今日推荐