Live demo
Use the buttons below to show and hide an offcanvas element via JavaScript that toggles the .show class on an element with the .offcanvas class.
Offcanvas
Body scrolling
Scrolling the element is disabled when an offcanvas and its backdrop are visible. Use the data-bs-scroll attribute to enable scrolling.
Offcanvas with body scrolling
Try scrolling the rest of the page to see this option in action.
Body scrolling and backdrop
You can also enable scrolling with a visible backdrop.
Backdrop with scrolling
Try scrolling the rest of the page to see this option in action.
Static backdrop
When backdrop is set to static, the offcanvas will not close when clicking outside of it.