当您需要描述链接时,工具提示会很有用。该插件的灵感来自Jason Frame编写的jQuery.tipsy插件。此后,工具提示已更新为可以在没有图像的情况下工作,并带有CSS动画和用于本地标题存储的数据属性。
工具提示插件可按需生成内容和标记,默认情况下将工具提示放置在其触发元素之后。
您可以尝试运行以下代码以在Bootstrap中实现工具提示插件-
<!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 style = "padding: 100px 100px 10px;"> This is a <a href = "#" class = "tooltip-show" data-toggle = "tooltip" title = "show">Tooltip on method show</a>. This is a <a href = "#" class = "tooltip-hide" data-toggle = "tooltip" data-placement = "left" title = "hide">Tooltip on method hide</a>. This is a <a href = "#" class = "tooltip-destroy" data-toggle = "tooltip" data-placement = "top" title = "destroy">Tooltip on method destroy</a>. This is a <a href = "#" class = "tooltip-toggle" data-toggle = "tooltip" data-placement = "bottom" title = "toggle">Tooltip on method toggle</a>. <br><br><br><br><br><br> <p class = "tooltip-options" > This is a <a href = "#" data-toggle = "tooltip" title = "<h2>'am Header2 </h2>">Tooltip on method options</a>. </p> <script> $(function () { $('.tooltip-show').tooltip('show');}); $(function () { $('.tooltip-hide').tooltip('hide');}); $(function () { $('.tooltip-destroy').tooltip('destroy');}); $(function () { $('.tooltip-toggle').tooltip('toggle');}); $(function () { $(".tooltip-options a").tooltip({html : true });}); </script> </div> </body> </html>