Jquery-mobile-btn-inline-button

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

jQuery Mobile-インラインボタン

説明

*_ui-btn-inline_* クラスを使用して、ボタンをコンテンツと同じ幅で表示できます。

次の例は、jQuery Mobileフレームワークでの_inline button_の使用を示しています。

<!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>First Page Header</h2>
         </div>

         <div data-role = "main" class = "ui-content">
            <p>Normal Button</p>
            <a href = "#page2" class = "ui-btn">Click here to go Page Two</a>
            <p>Inline Button</p>
            <a href = "#page2" class = "ui-btn">Click here to go Page Two</a>
         </div>

         <div data-role = "footer">
            <h2>First Page Footer</h2>
         </div>
      </div>

      <div data-role = "page" id = "page2">
         <div data-role = "header">
            <h2>Second Page Header</h2>
         </div>

         <div data-role = "main" class = "ui-content">
            <p>These are inline buttons</p>
            <a href = "#page1" class = "ui-btn ui-btn-inline">Click here to go Page One</a>
            <a href = "#page1" class = "ui-btn ui-btn-inline">Click here to go to Page One</a>
            <a href = "#page1" class = "ui-btn ui-btn-inline">Click here to go to Page One</a>
         </div>

         <div data-role = "footer">
            <h2>Second Page Footer</h2>
         </div>
      </div>
   </body>
</html>

出力

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

  • 上記のHTMLコードを btn_inline_buttonl ファイルに保存します。
  • localhostを使用してブラウザでこのHTMLファイルを開くと、次のような出力が表示されます。