我有jquery弹出窗口,可以在手机和电脑的所有浏览器上打开。我不想在移动浏览器上显示它,所以我该怎么做?
function lightbox(){
$.colorbox({inline:true, href:"#inline_content",onClosed: pauseSound, overlayClose: false});
}
谢谢!
答案 0 :(得分:0)
你可以试试这个:
function lightbox(){
if (screen.width <=700) #or whatever you want
{
$.colorbox({inline:true, href:"#inline_content",onClosed: pauseSound, overlayClose: false});
}
}
答案 1 :(得分:0)
在What is the best way to detect a mobile device in jQuery?的基础上建立你可以做到这一点
function lightbox(){
if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
return;
}
$.colorbox({inline:true, href:"#inline_content",onClosed: pauseSound, overlayClose: false});
}