【问题标题】:javascript and jquery script tags in bootstrap引导程序中的 javascript 和 jquery 脚本标签
【发布时间】:2012-10-25 20:48:23
【问题描述】:

我在使用引导程序时遇到了一些问题。我开始遇到nav 组件中的链接不可点击的问题。链接在浏览器中输入时很好,但在单击时却没有。

我在正文底部重新排列了脚本标签的顺序,因此我的 Django 静态目录中指向 jQuery 的链接首先出现,并且链接变为“可点击”,尽管它破坏了其他功能,如菜单下拉菜单和手风琴,不再打开。

我尝试将脚本标签移动到该部分,然后将它们切换回来;尝试了jQuery的开发版本....似乎没有任何工作。

发生了什么事?我怎样才能同时激活链接和 javascript 功能。

  <head>
        {% block head %}
        # ...
        # ...

        {% load static %}

            <link href="{% static 'css/bootstrap.css' %}" rel="stylesheet">
            <link href="{% static 'css/custom.css' %}" rel="stylesheet">

            <style type="text/css">
              body {
                padding-top: 60px;
                padding-bottom: 40px;
              }
            </style>
            <link href="{% static 'css/bootstrap-responsive.css' %}" rel="stylesheet">
        {% endblock head %}

   </head>

   <body id="body">
          {% block body %} 

           #.....
           #.....

            <!-- Le javascript
            ================================================== -->
            <!-- Placed at the end of the document so the pages load faster -->

            <script src="{% static 'js/jquery-1.8.2.min.js' %}"></script>
            <script src="{% static 'js/bootstrap.min.js' %}"></script>


          {% endblock body %}  
  </body>

【问题讨论】:

  • 您不需要在这些网址周围加上引号吗?
  • 我现在在标签内的路径周围有引号和单引号中的标签,但它仍然无法正常工作。

标签: javascript django twitter-bootstrap


【解决方案1】:

经过大量搜索和下巴抚摸,我意识到在我从我的角度调用的模板中,我有以下内容:

  {% for group in class_groups %}
    <li><a data-toggle=**"tab"** href="{% url 'subnav' sub_slug=subj class_grp_slug=group.group_name %}">{{ group.group_name }}</a>
  {% endfor %}

实际上应该是什么时候:

  {% for group in class_groups %}
    <li><a data-toggle=**"tabs"** href="{% url 'subnav' sub_slug=subj class_grp_slug=group.group_name %}">{{ group.group_name }}</a>
  {% endfor %}

下拉菜单和导航选项卡现在都可以使用。

【讨论】:

    猜你喜欢
    • 2013-05-31
    • 1970-01-01
    • 1970-01-01
    • 2015-06-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-08
    相关资源
    最近更新 更多