jQuery Mobile - 工具欄主題



說明

  • 主題樣本預設情況下由頁面的頁首和頁尾工具欄繼承;但是,你可以輕鬆地設定主題樣本的顏色。

  • 每當你使用外部固定工具欄時,你都必須始終設定一個主題,因為沒有可以從中繼承主題的父級頁面。

示例

以下示例演示了在 jQuery Mobile 中使用“工具欄主題”。

<!DOCTYPE html>
<html>
   <head>
      <title>Toolbar Theme</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 = "page" id = "page1">
         
         <div data-role = "header" data-theme = "b">
            <h2>Header</h2>
         </div>
         
         <div data-role = "main" class = "ui-content">
            <h2>Page content</h2>
         </div>
         
         <div data-role = "footer" data-theme = "b">
            <h2>Footer</h2>
         </div>
      </div>
   </body>
</html>

輸出

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

  • 將上述 html 程式碼儲存為toolbar_theme.html檔案,並將其放在伺服器根資料夾中。

  • 使用 https:///toolbar_theme.html 開啟這個 HTML 檔案,將會顯示以下輸出。

jquery_mobile_widgets.htm
廣告
© . All rights reserved.