2016-09-27 2 views
0

jquery 대화 상자가 열릴 때 선택할 수 있어야하지만 아무것도 작동하지 않는 것 같습니다.jquery mobile 대화 상자가 표시 될 때 사용자 정의하는 방법은 무엇입니까?

지금까지 필자가 작동이

<html> 
<head> 
    <meta charset="UTF-8"> 
    <title>Document</title> 

    <!-- Include meta tag to ensure proper rendering and touch zooming --> 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 

    <!-- Include jQuery Mobile stylesheets --> 
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> 

    <!-- Include the jQuery library --> 
    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> 

    <!-- Include the jQuery Mobile library --> 
    <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> 

</head> 
<body> 
     <div data-role="main" class="ui-content"> 

      <a href="#myPopupDialog" data-rel="popup" data-role="dialog" data-position-to="window" data-transition="fade" class="ui-btn ui-corner-all ui-shadow ui-btn-inline">Open Dialog Popup</a> 

      <a href="#" onclick="test()">Test</a> 

      <div data-role="popup" id="myPopupDialog"> 

       <div data-role="header"> 
        <h1>But wait theres more!</h1> 
       </div> 

       <div data-role="main" class="ui-content"> 
        <h2 style="text-align: center;">Would you like an exclusive offer?</h2> 
        <a href="#" class="ui-btn ui-corner-all" data-rel="back">Sounds Good!</a> 
        <a href="#" class="ui-btn ui-corner-all ui-icon-back" data-rel="back" data-theme="a">No Thanks, Take me back..</a> 
       </div> 

       <div data-role="footer"> 
        <h1>Footer Text</h1> 
       </div> 

      </div> 
     </div> 

<script> 

    $(document).ready(function(){ 

     console.log(document.body.scrollTop); 

     if(document.body.scrollTop === 0) 
     { 
      $.mobile.changePage('#myPopupDialog', 'pop', true, true); 
     } 

    }); 

</script> 
</body> 
</html> 

을 시도하지만 난 자바 스크립트에서 if 문을 변경할 때 난 그냥 나던 쇼 상단에있는 앵커 태그를 제거하면 그것은 또한 중단 ... jQuery를 모바일은있다 나 혼란스러워.

어쨌든 내 질문은 수동으로 페이지에 대화 상자를 표시하는 방법이며, 다른 페이지가 아닌 동일한 페이지에 표시하는 것이 좋습니다.

+0

죄송합니다 아무것도는 –

+0

'$ ("# myPopupDialog") 팝업 ("열기")'하지'$를 제공 아픈 당신이 필요로하는 것을 요구하는 의견을 남겨주세요 누락 된 경우. .mobile.changePage ('# myPopupDialog'.... ') 대화 상자와 팝업이 동일하지 않습니다 .jQM 문서를 참조하십시오 – Omar

답변

-1

사용이 :

$("#myPopupDialog").addClass("ui-page-active ui-page ui-page-theme-a") 
+0

자세한 정보로 수정하십시오 코드 전용 및 "시도하십시오"답변은 권장하지 않습니다. 검색 가능한 콘텐츠가 포함되어 있지 않으며 왜 누군가가 "이 기능을 시도해야하는지"에 대해 설명하지 마십시오. – abarisone

+0

어느 쪽이든 나를 위해이 작업을 수행하지 못했습니다. 수정본을 발견하고 시간이되면 솔루션을 추가 할 것입니다. –

관련 문제