2016-09-27 10 views
0

jqueryダイアログが開いたときに選択できるようにする必要がありますが、私は何もしていないようです。jquery mobileダイアログに表示されるカスタマイズ方法

は、これまでIVEは動作します。この

<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> 

を試みたが、私はJavaScriptでif文を変更したときに私はそれだけでdoesntのショー上部にアンカータグを削除する場合、それはまた壊れる... jQueryのモバイルを持っています私は混乱しています。

とにかく私の質問は、ページ上に手動でダイアログボックスを表示する方法です。同じページに表示するのが好きで、別のページでは表示しません。

+0

申し訳ありませんが何もそれが –

+0

'$( "#myPopupDialog")のポップアップ( "オープン")'ない '$を提供病気に必要なものを要求コメントを残して下さい欠落している場合。 .mobile.changePage( '#myPopupDialog' .... 'ダイアログとポップアップは同じではありません.jQMドキュメントを参照してください。 – Omar

答えて

-1

使用この:

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

詳細については、コードのみと「試してください」の回答は避けてください。 – abarisone

+0

いずれにしても、これは私の仕事ではありませんでしたが、修正が見つかったので、時間がたつと解決策が追加されます –

関連する問題