jQuery Mobile - 彈出式工具提示



說明

當您將滑鼠懸停在元素上時,使用data-rel = "popup"data-transition = "pop"屬性 ui-content 類展示小型彈出框。

示例

以下示例演示了在 jQuery Mobile Framework 中使用彈出式工具提示

<!DOCTYPE html>
<html>
   <head>
      <title>Popup Tooltip</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">
         <div data-role = "header">
            <h2>Header</h2>
         </div>
         
         <div data-role = "main" class = "ui-content">
            <p>This is example of tooltip. <a href = "#popup_tooltip" data-rel = "popup" 
               data-transition = "pop"  class = "ui-btn ui-alt-icon ui-nodisc-icon 
               ui-btn-inline ui-icon-info ui-btn-icon-notext" title = "This is Tooltip">
               More Info</a></p>
               
            <div data-role = "popup" id = "popup_tooltip" class = "ui-content" 
               data-theme = "a">
               <p>Welcome to Tutorialspoint.....</p>
            </div>
         </div>
      
         <div data-role = "footer">
            <h2>Footer</h2>
         </div>
      </div>
   </body>
</html>

輸出

讓我們執行以下步驟,瞭解以上程式碼如何工作 -

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

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

jquery_mobile_widgets.htm
廣告
© . All rights reserved.