0

我正在使用 twitter 引导工具提示。我有包含文件 bootstrap.js 的 base.html 在扩展 base.html 的模板中,我有用于显示工具提示的脚本。

<script type="text/javascript">
        $(function () {
        console.log("In tooltip");
           $(".tip").tooltip();
        });
</script)

问题是,工具提示在当前情况下不显示。如果我在模板中导入 jquery 库,它会显示工具提示,但引导程序的其他功能(例如下拉菜单)则不起作用。我想这很简单,但我对 jquery 尤其陌生。

更新 脚本在我的文件中按以下顺序编写。

base.html

<head>
   <script type="text/javascript" src="/static/js/jquery.min.js"></script>
   <script type="text/javascript" src="/static/js/bootstrap.js"></script>
   <script type="text/javascript" src="/static/js/jquery-1.9.1.js"></script>
</head>
<body>
   {% block content %}
   {% end block %}
</body>

在我的模板中,

{% extends base.html %}
 {% block content %}

  <script type="text/javascript" src="/static/js/bootstrap.js"></script>  (I have to call this and comment the one in the base.html for tooltip to work)

 <script type="text/javascript">
        $(function () {
        console.log("In tooltip");
           $(".tip").tooltip();
        });
</script)
 {% end block %}
4

0 回答 0