You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to design a single-page layout with Bootstrap 5 beta1 that also needs a collapsible mobile menu. I'm also using Scrollspy. The default behavior for collapsible menus in BS5 is to leave the mobile menu open after a click on an option, but on a single page layout there is no page refresh to close the menu after a selection. So I added data-bs-toggle="collapse" and data-bs-target to each link item in the menu, like this:
This closes the collapsible menu when an option is clicked as I want, but it seems that the link itself is ignored and the page doesn't move down to the section ID specified in the link.
Is there a way to make the clicks also go to the link after the menu collapses? Or will this require custom javascript? If it requires custom javascript, has anyone already figure this out? My javascript is novice level. I found lots of solutions on Stack Overflow, but, it's all jQuery solutions, and I'd like to avoid having to use jQuery just for this one task. Thanks and Happy New Year!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to design a single-page layout with Bootstrap 5 beta1 that also needs a collapsible mobile menu. I'm also using Scrollspy. The default behavior for collapsible menus in BS5 is to leave the mobile menu open after a click on an option, but on a single page layout there is no page refresh to close the menu after a selection. So I added
data-bs-toggle="collapse"
anddata-bs-target
to each link item in the menu, like this:This closes the collapsible menu when an option is clicked as I want, but it seems that the link itself is ignored and the page doesn't move down to the section ID specified in the link.
Is there a way to make the clicks also go to the link after the menu collapses? Or will this require custom javascript? If it requires custom javascript, has anyone already figure this out? My javascript is novice level. I found lots of solutions on Stack Overflow, but, it's all jQuery solutions, and I'd like to avoid having to use jQuery just for this one task. Thanks and Happy New Year!
Beta Was this translation helpful? Give feedback.
All reactions