Javascript 引导下拉列表活动悬停时打开,单击时链接

Javascript 引导下拉列表活动悬停时打开,单击时链接,javascript,jquery,css,twitter-bootstrap,django-oscar,Javascript,Jquery,Css,Twitter Bootstrap,Django Oscar,我一直在尝试修改django oscar的导航栏菜单 我不明白的是,“浏览商店”菜单在主页页面加载时保持打开状态,但在单击所有其他页面时打开。我不明白为什么会这样。有没有办法让它在悬停时打开并添加 {%category_tree depth=2作为树_categories%} {%if树\类别%} {对于树\类别,信息在树\类别%} {%if.info.has_children%} {%else%} {%endif%} {info.num_to_close%} {%endfor%}

我一直在尝试修改django oscar的导航栏菜单

我不明白的是,“浏览商店”菜单在主页页面加载时保持打开状态,但在单击所有其他页面时打开。我不明白为什么会这样。有没有办法让它在悬停时打开并添加

    {%category_tree depth=2作为树_categories%}
  • {%if树\类别%}
  • {对于树\类别,信息在树\类别%} {%if.info.has_children%}
    • {%else%}
    • {%endif%} {info.num_to_close%}
  • {%endfor%} {%endfor%} {%endif%}
{%block nav_extra%} {%endblock%} {%endblock%}
主菜单之所以这样做,是因为在

<div class="navbar-collapse primary-collapse collapse">
        {% block nav_dropdown %}
            <ul id="browse" class="nav navbar-nav">
                <li class="dropdown active {% if expand_dropdown %}open{% endif %}">
                    <a href="#" class="dropdown-toggle" {% if not expand_dropdown %} data-toggle="dropdown"{% endif %}>
                        <span class="nav-line-1">Shop by</span><span class="nav-line-2">  Category</span>
                        <b class="caret"></b>
                    </a>
                    <ul class="dropdown-menu" data-navigation="dropdown-menu">
                        {% category_tree depth=2 as tree_categories %}
                        <li><a tabindex="-1" href="{% url 'catalogue:index' %}">{% trans "All products" %}</a></li>
                        {% if tree_categories %}
                            <li class="divider"></li>
                            {% for tree_category, info in tree_categories %}
                                {% if info.has_children %}
                                    <li class="dropdown-submenu">
                                        <a tabindex="-1" href="{{ tree_category.get_absolute_url }}">{{ tree_category.name }}</a>
                                        <ul class="dropdown-menu">
                                        {% else %}
                                            <li><a tabindex="-1" href="{{ tree_category.get_absolute_url }}">{{ tree_category.name }}</a></li>
                                        {% endif %}

                                        {% for close in info.num_to_close %}
                                            </ul></li>
                                        {% endfor %}
                            {% endfor %}
                        {% endif %}
                    </ul>
                </li>
                {% block nav_extra %}
                {% endblock %}
            </ul>
        {% endblock %}

    </div><!-- /navbar-collapse -->
</div>
<ul id="browse" class="nav">
    <li class="dropdown active"> 
      <a href="#" class="dropdown-toggle" data-toggle="dropdown">Browse store<b class="caret"></b></a>
        <ul class="dropdown-menu" data-navigation="dropdown-menu" style="width: 212px;">
            <li><a tabindex="-1" href="/en-gb/catalogue/">All products</a>
            </li>
            <li class="divider"></li>
            <li class="dropdown-submenu"> 
                <a tabindex="-1" href="/en-gb/catalogue/category/books_1/">Books</a>
                <ul class="dropdown-menu">
                    <li><a tabindex="-1" href="/en-gb/catalogue/category/books/fiction_2/">Fiction</a>
                    </li>
                    <li><a tabindex="-1" href="/en-gb/catalogue/category/books/non-fiction_4/">Non-Fiction</a>
                    </li>
                </ul>
            </li>
            <li class="divider"></li>
            <li><a href="/en-gb/offers/">Offers</a>
            </li>
        </ul>
    </li>
</ul>
$('.dropdown').hover(function(){ 
  $('.dropdown-toggle', this).trigger('click'); 
});