jQuery Mobile - 頁尾中的導航欄



說明

要將導航欄新增到頁面的底部,請用具有 data-role = "footer" 屬性的容器中的導航欄將其包裝起來。

示例

以下示例演示了 jQuery Mobile 中頁尾導航欄的使用。

<!DOCTYPE html>
<html>
   <head>
      <title>Navbars in footers</title>
      <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 = "footer" style = "overflow:hidden;">
         <h2>This is Footer</h2>
         <div data-role = "navbar">
            <ul>
               <li><a href = "#" class = "ui-btn-active">Home</a></li>
               <li><a href = "#">About Us</a></li>
               <li><a href = "#">Contact Us</a></li>
            </ul>
         </div>
      </div>
   </body>
</html>

輸出

讓我們執行以下步驟,看看上面的程式碼是如何工作的 −

  • 將上述 html 程式碼另存為navbar_footers.html檔案,放在伺服器的根目錄中。

  • 將 HTML 檔案作為 https:///navbar_footers.html 開啟,將顯示以下輸出。

jquery_mobile_widgets.htm
廣告
© . All rights reserved.