2012-09-07 3 views
1

다음 기능을 사용하여 누군가가 오버레이를 클릭 할 때 닫히는 모달 대화 상자가 있습니다.이 대화 상자는 iPad 및 iPhone Safari를 제외한 모든 브라우저에서 작동합니다.iPad jquery live ('click') 문제

$(".ui-widget-overlay").live('click', function() { 
//mycode to close modal dialog 
}); 

클릭 (하지만 .ui-widget-overlay ")하지만 작동하지 않습니다.

jQuery live event on iPad...why doesn't it work? 그래서 나는 라이브 기능을하기 전에 속성을 추가하려고했지만 그것이 작동하지 않는 요소에는 온 클릭 속성이없는 경우

라이브 기능은 아이 패드에서 작동하지에 문제가 있습니다. 내가하는 일은 다음과 같습니다.

$(".ui-widget-overlay").attr('onclick', ''); 
$(".ui-widget-overlay").live('click', function() { 
//mycode to close modal dialog 
}); 

누구든지 해결책을 찾았습니까?

+0

'클릭'도 트리거됩니까? iPads에는 탭 이벤트 패밀리가 있습니다. – zerkms

+0

나는 이것을 시도했지만 여전히 작동하지 않았다 : $ (".ui-widget-overlay"). bind ('tap', onclick); –

+1

나는'tap'이라는 이름의 이벤트가 있다고 말하지 않았지만'touchstart'가 있습니다. 또한 jquery mobile – zerkms

답변

0
$j(".telephonePopup").dialog({ 
    open: function (event) { 
     $j('.ui-widget-overlay').live("touchstart click", function() { 
      $j(".telephonePopup").dialog("close"); 
      return false; 
     }); 

        // if you want also to stop scrolling while popup is displayed 
     document.ontouchmove = function(e){ 
      e.preventDefault(); 
     } 
    }, 
    close: function (event) { 
     $j('html').removeClass('stop-scrolling'); 
     document.ontouchmove = null; 
    },