如何使用 Bootstrap 浮动提示插件


浮动提示与工具提示类似,提供了一个带有标题的扩展视图。要激活浮动提示,用户只需将光标悬停在元素上。浮动提示的内容可以使用 Bootstrap 数据 API 完全填充。

你可以尝试运行以下代码来实现浮动提示插件

示例

体验演示

<!DOCTYPE html>
<html>
   <head>
      <title>Bootstrap Example</title>
      <link href = "/bootstrap/css/bootstrap.min.css" rel = "stylesheet">
      <script src = "/scripts/jquery.min.js"></script>
      <script src = "/bootstrap/js/bootstrap.min.js"></script>
   </head>
   <body>
      <div class = "container" style = "padding: 100px 50px 10px;" >
         <button type = "button" class = "btn btn-default" title = "Popover title"
            data-container = "body" data-toggle = "popover" data-placement = "left"
            data-content = "Some content in Popover on left">
               Popover on left
         </button>
         <button type = "button" class = "btn btn-primary" title = "Popover title"
            data-container = "body" data-toggle = "popover" data-placement = "top"
            data-content = "Some content in Popover on top">
            Popover on top
         </button>
         <button type = "button" class = "btn btn-success" title = "Popover title"
            data-container = "body" data-toggle = "popover" data-placement = "bottom"
            data-content = "Some content in Popover on bottom">
            Popover on bottom
         </button>
         <button type = "button" class = "btn btn-warning" title = "Popover title"
            data-container = "body" data-toggle = "popover" data-placement = "right"
            data-content = "Some content in Popover on right">
            Popover on right
         </button>
      </div>
      <script>
         $(function (){
            $("[data-toggle = 'popover']").popover();
         });
      </script>
   </body>
</html>

更新于: 12-6-2020

146 次浏览

开启你的职业生涯

完成课程,获得认证

开始吧
广告