2013-08-23 3 views
0

휴대 전화 및 PC의 모든 브라우저에서 열리는 jquery 팝업이 있습니다. 모바일 브라우저에 표시하지 않으려면 어떻게해야합니까?팝업이 모바일 브라우저에 없음

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

고마워요!

+0

가능한 중복 할 수있다 (HTTP를 [jQuery를에 핸드 헬드 장치를 감지하는 가장 좋은 방법은 무엇입니까?] //stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-handheld-device-in-jquery) – mplungjan

답변

0

이 작업을 시도 할 수 있습니다 :

function lightbox(){ 
if (screen.width <=700) #or whatever you want 
    { 
    $.colorbox({inline:true, href:"#inline_content",onClosed: pauseSound, overlayClose: false}); 
    } 
} 
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}); 
} 
+0

모바일 브라우저에서 팝업을 열지는 않지만 나는 생각합니다. 그것을 사용하면 태블릿에서도 팝업이 열리지 않습니다. –

+0

지난 번에 보니 대부분의 태블릿에서는 모바일 브라우저를 사용합니다 :) – mplungjan

+0

예 .. screen.width를 사용하면 좋은 방법일까요? –

관련 문제