0
我在Rails上使用Bootstrap4來製作不使用JS的可摺疊菜單。每個菜單項都應該打開它的div並摺疊其他菜單。但是,我無法做到這一點。點擊一個按鈕時是否有辦法摺疊所有其他div?Bootstrap4:顯示/隱藏Div按鈕
%button.btn.dropdown-toggle{"aria-expanded" => "false", "aria-haspopup" => "true", "data-toggle" => "dropdown", :type => "button"}
All Stuff
.dropdown-menu
%a.dropdown-item{"aria-controls" => "collapseFree", "aria-expanded" => "false", "data-toggle" => "collapse", :href => "#collapseFree"}
Free Stuff
%a.dropdown-item{"aria-controls" => "collapseNew", "aria-expanded" => "false", "data-toggle" => "collapse", :href => "#collapseNew"}
New Stuff
#collapseFree.collapse
..
#collapseNew.collapse
..