美文网首页
判断当前页面是否在移动端打开的方法

判断当前页面是否在移动端打开的方法

作者: sendSnow | 来源:发表于2019-07-23 10:37 被阅读0次

    1.使用 in 判断

    var isMobile  = 'ontouchstart' in document;

    如果 isMobile == true ;则当前页面是在移动端打开,否则为PC端打开的当前页面

    相关文章

      网友评论

          本文标题:判断当前页面是否在移动端打开的方法

          本文链接:https://www.haomeiwen.com/subject/txbvlctx.html