字体很棒,没有使用工具提示

时间:2017-03-09 23:38:28

标签: javascript twitter-bootstrap font-awesome

我想从bootstrap 4弹出一个工具提示,以便在单击字体真棒图标时显示。按钮什么也没发生。我的代码如下:

  <a href='#' data-toggle='tooltip' title='Some tooltip text!'><i class='fa fa-info-circle' aria-hidden='true'>&nbsp;</i></a>

我需要制作一个javascript函数吗?

编辑:

我有以下脚本:

    <script   src="https://code.jquery.com/jquery-3.1.1.min.js"   integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="   crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<script src="https://use.fontawesome.com/0a5d051ab0.js"></script>

1 个答案:

答案 0 :(得分:0)

Tooltip是一个“选择加入”组件,因此您必须在要提供工具提示的元素上调用.tooltip()

$("[data-toggle='tooltip']").tooltip();
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script   src="https://code.jquery.com/jquery-3.1.1.min.js"   integrity="sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="   crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>
<script src="https://use.fontawesome.com/0a5d051ab0.js"></script>
<div class="container">
<br><br>

<a href='#' data-toggle='tooltip' title='Some tooltip text!'><i class='fa fa-info-circle' aria-hidden='true'>&nbsp;</i></a>
</div>