Bootstrap .tooltip(options) 方法


使用 Bootstrap 的 tooltip(“options”) 方法啟用工具提示。

將游標放在下面的按鈕上,工具提示可見 −

<button class="btn btn-default btn-lg">
  Keep cursor
</button>

以下指令碼使用 tooltip(options) 類來生成工具提示 −

$(document).ready(function(){
  $('.btn-default').tooltip({title: "demo", placement: "top"});
});

你可以嘗試執行以下程式碼來實現 tooltip(“options”) 方法 −

示例

實際演示

<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Bootstrap Example</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  </head>

<body>

  <div class="container">
    <h3>Example</h3>
    <p>Tootltip will be visible after you mouse hover the below button:</p>
    <div>
      <button class="btn btn-default btn-lg">Keep cursor</button>
    </div>
  </div>

  <script>  
  $(document).ready(function(){
    $('.btn-default').tooltip({title: "demo", placement: "top"});
  });
  </script>

</body>
</html>

更新於:18-6 月-2020

857 次觀看

啟動你的 職業生涯

完成課程認證

開始
廣告
© . All rights reserved.