I have a div
which I want to always show for long screen devices. For small screen devices, I want to show a button with hamburger menu and slide in the div
from left edge of the device screen when the hamburge button is clicked. This is possible out of the box with offcanvas
property in bootstrap 5. But, our project uses "bootstrap": "^4.6.0"
which does not support offcanvas property.
Our current project uses "react-bootstrap": "^1.4.3"
which does not support offcanvas
component. However, version react-bootstrap 2.7
does support offcanvas.
Quick googling lead me to many workarounds which achieves the same with jQuery or some JS: example-1, example-2, example-3
Apart from this, I tried this react-offcanvas-menu-component, but it was giving conflicts in npm packages.
Is it possible to achieve the same with bootstrap-4? If not, can I achieve the same result without needing to custom write JS and complex CSS? Or is there some library / npm package which allows to achieve the same?
How should I implement offcanvas menu in react in our project (avoiding any major JS framework like jQuery that follows different paradigm from React's components based paradigm)? Or I am without any solution?