Jquery-mobile-dialogs-chaining

提供:Dev Guides
移動先:案内検索

jQuery Mobile-チェーンダイアログ

説明

*_data-rel = "back" _* 属性は、前のダイアログに戻るためにナビゲートするために使用されます。 1つのダイアログが2番目のダイアログボックスにチェーンされ、2番目のダイアログが3番目のダイアログボックスにチェーンされている場合、3番目のダイアログで_data-rel = "back" _を使用すると、2番目のダイアログボックスに移動できます

次の例は、jQuery Mobileでのダイアログのチェーンの使用を示しています。

<!DOCTYPE html>
<html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
   </head>

   <body>
      <div data-role = "page" id = "page1">
         <div data-role = "header">
            <h2>Header</h2>
         </div>

         <div role = "main" class = "ui-content">
            <a href = "#page2" class = "ui-shadow ui-btn ui-corner-all ui-btn-inline">
               Open Dialog</a>
         </div>

         <div data-role = "footer">
            <h4>Footer</h4>
         </div>
      </div>

      <div data-role = "page" data-dialog = "true" id = "page2">
         <div data-role = "header">
            <h1>First Dialogs</h1>
         </div>

         <div role = "main" class = "ui-content">
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
            Lorem Ipsum has been the industry's standard dummy text ever since the
            1500s.</p>

            <a href = "#page3" class = "ui-shadow ui-btn ui-corner-all ui-btn-inline">
               Open Second Dialog</a>
         </div>
      </div>

      <div data-role = "page" data-dialog = "true" data-close-btn = "none" id = "page3">
         <div data-role = "header">
            <h1>Second Dialogs</h1>
         </div>

         <div role = "main" class = "ui-content">
            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
            Lorem Ipsum has been the industry's standard dummy text ever since the
            1500s.</p>

            <a href = "#page1" class = "ui-btn ui-corner-all" data-rel = "back">
               Back to First Dialog </a>
         </div>
      </div>
   </body>
</html>

出力

上記のコードがどのように機能するかを確認するために、次の手順を実行してみましょう-

  • 上記のHTMLコードを chaining_dialogsl ファイルとしてサーバーのルートフォルダーに保存します。
  • このHTMLファイルをhttp://localhost/chaining_dialogslとして開くと、次の出力が表示されます。