0

I have jquery popup which opens on all browsers from mobiles and pc. i don't want to show it on mobile browsers so how can i do that ?

function lightbox(){
$.colorbox({inline:true, href:"#inline_content",onClosed: pauseSound, overlayClose: false});
            }

Thanks!

Amirhossein Mehrvarzi
  • 11,037
  • 6
  • 38
  • 65
  • possible duplicate of [What is the best way to detect a handheld device in jQuery?](http://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-handheld-device-in-jquery) – mplungjan Aug 23 '13 at 12:29

2 Answers2

0

You can try this:

function lightbox(){
if (screen.width <=700) #or whatever you want
  {
  $.colorbox({inline:true, href:"#inline_content",onClosed: pauseSound, overlayClose: false});
  }
}
Manolo
  • 16,729
  • 16
  • 67
  • 115
0

Building on What is the best way to detect a mobile device in jQuery? you can do this

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});
 }
Community
  • 1
  • 1
mplungjan
  • 134,906
  • 25
  • 152
  • 209