我是bootstrap的新手。我正在使用data-toggle =“collapse”制作侧边栏手风琴导航,但它默认关闭导航。我该怎么办默认情况下打开导航,当我点击它时它就会关闭。
HTML
!function ($) {
$(document).on("click","ul.nav li.parent > a > span.icon", function(){
$(this).find('em:first').toggleClass("glyphicon-minus");
});
$(".sidebar span.icon").find('em:first').addClass("glyphicon-plus");
}(window.jQuery);
JS
def build_links(resource)
YAML.load_file("config/admin_links.yml")[resource].collect do |link|
active = (eval(link.last) == request.path) ? "active" : ""
path = link.last.empty? ? "#" : eval(link.last)
content_tag(:li, link_to(link.first, path), class: active)
end.join.html_safe
答案 0 :(得分:0)
您需要将in
类添加到ul。即:
<ul class="children in collapse" id="sub-item-3">