判断设备是pc端还是移动端
作者:
咏竹莉 | 来源:发表于
2018-05-23 16:06 被阅读0次//检测设备终端 后确定是否添加滚动条插件
//pc端添加默认滚动条插件 移动端不添加
function deviceEnd(className,classNamePc) {
if( navigator.userAgent.match(/Android/i)
|| navigator.userAgent.match(/webOS/i)
|| navigator.userAgent.match(/iPhone/i)
|| navigator.userAgent.match(/iPad/i)
|| navigator.userAgent.match(/iPod/i)
|| navigator.userAgent.match(/BlackBerry/i)
|| navigator.userAgent.match(/Windows Phone/i)
){
//是移动端
$('.'+className).addClass('scrollPad');
//$('.projectListBody').addClass('projectListBodyPad');
}
else {
//是pc端
//右侧项目列表 滚动条
$('.'+className).addClass(classNamePc);
$('.'+className).perfectScrollbar();
}
}
本文标题:判断设备是pc端还是移动端
本文链接:https://www.haomeiwen.com/subject/yzwrjftx.html
网友评论