Bootstrap .popover(options) 方法


要使用選項啟用彈出,你需要使用 .popver(options) 方法 -

設定彈出按鈕為 -

<button class="btn btn-default btn-md">
  Timings
</button>

設定彈出標題、頭等。所有這些都屬於彈出選項 -

$(document).ready(function(){
  $('.btn-default').popover({title: "Event Timings", content: "3PM - 6PM", placement: "right"});
});

讓我們看 .popover(method) 的完整示例 -

示例

線上演示

<!DOCTYPE html>
<html>
  <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>Information</h3>
    <p>Details about the event:</p>
    <div>
      <button class="btn btn-default btn-lg">Timings</button>
    </div>
  </div>

<script>
  $(document).ready(function(){
    $('.btn-default').popover({title: "Event Timings", content: "3PM - 6PM", placement: "right"});
  });
</script>

</body>
</html>

更新於: 2020 年 6 月 15 日

647 次瀏覽

開創你的 事業

完成課程並獲得認證

開始
廣告
© . All rights reserved.