It’s been less than a month since I started Bootstrap. Thanks to everyone, I was able to do what I wanted to do little by little.
I read the Bootstrap docs and created an Offcanvas that is displayed from the right side. However, clicking the A tag link on the LP page does not close the menu.
I thought it would be a success if I hid #offcanvasRight, but I couldn’t hide the gray of Offcanvas. Is there a good way? You can download the file I made. Always thak you.
$(function(){
var navLink = $("#offcanvasRight");
navLink.on("click", "a", null, function () {
navLink.collapse('hide') ;
});
});
You’re welcome!
I had a client request this feature for their website to allow anchors within the navbar to click and scroll to a section. Before the navbar wouldn’t close, I originally got the source code from Fiddle. Originally the code is a bit longer, because it also includes dropdown menus in the navigation. But I was able to condense it to a smaller size and use it only for links.
I’m glad it fixes your issue! Consider using BSS offcanvas component though and change the position to “End” from the options panel for a offcanvas on the right side. Link it with the “Navbar Toggle” by adding it to the “Selector” under the options panel.
Actually, I knew that the BSS component offcanvas was prepared. But, I didn’t know how to use it. I didn’t know at how offcanvas component would work…
Offcanvas is easily on the right side after repositioning! I thought it would only be displayed from the left side. Next, I installed a button. It worked when I specified “#offcanvas-1” as the “target” in the options panel. I was able to offcanvas without using the keyboard!
When I asked a question on the Navbar, I was able to do what I wanted from the options panel. I will look more carefully at the options panel from now on. All thanks to your kindness instructions.
You don’t need javascript for that to work, just add a data attribute to the links in the offcanvas data-bs-dismiss="offcanvas" and it will work without any extra javascript.
Add a dismiss button with the data-bs-dismiss=“offcanvas” attribute, which triggers the JavaScript functionality. Be sure to use the < button> element with it for proper behavior across all devices.
Awesome!!! I didn’t understand the meaning of the above sentence on the official Japanese Bootstrap website. Immediately below that, it was also described manually via JavaScript. So I didn’t understand why, so I searched answer on the net.
This time, I learned a lot. Thank you so much! Arigato-gozaimasu!