Topic: SideNav closeOnClick only for mobile devices
matthias_deox
pro
asked 6 years ago
Dave Fisher
pro
answered 6 years ago
Dave Fisher
pro
answered 6 years ago
if (options.closeOnClick === true && window.innerWidth < 1440)
but the issue now is that when the window resizes the issue is kinda worse. :) The code above must run only once since if you resize the window you don't get a change in behavior. The CSS rules change on a window.resize, but the fix above doesn't. Indeed a page refresh fixes the issue, but when using Angular there are rarely full page reloads. It works out to confuse users since they obviously don't do a page refresh after they resize the window. Is there a way to respond to the window.resize event and get this improved behavior?
Thanks!
- Dave
Michal Szymanski
staff
answered 6 years ago
if (options.closeOnClick === true)
replace with:
if (options.closeOnClick === true && window.innerWidth < 1540)
//Set your width here
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Pro
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No