Topic: closeOnClick:true closes fixed open SideNav in full screen

ales pro asked 7 years ago


Hello, just open any of your demos with # links (like this one) on the website and put the site to full width, over 1440px that is. Then, paste this into console: $('.button-collapse').sideNav({ closeOnClick:true }); Now, click any of the links in the menu and the menu slides out! I wasn't expecting this behaviour. Isn't the whole purpose of fixed SideNav to stay put with enough screen estate? It closes as expected when slided in on smaller screen. closeOnClick should only be active when the SideNav was slided into the screen after hamburger press, not when sitting fixed on the left edge. For SPA this is pretty annoying. Should I keep the state of the screen separately and show/hide the menu from my JS?

Marta Wierzbicka staff answered 7 years ago


Thank you for sharing this demo, it's really cool.

ales pro answered 7 years ago


Looking good. I turned away from SPA for my current project but might try this solution in the future.

cdenby pro answered 7 years ago


Http://apps.skippycanada.ca/reflectprototype/mdbversion.aspx

Marta Wierzbicka staff answered 7 years ago


Hi, could you show any demo how your solution works? It would be great. Best, Marta

cdenby pro answered 7 years ago


I think I found a workaround, at least for me. When I have an in the sidenav that has an onClick event, I can add this code to it and the clicking of the overlay will behave as you wish. In my case, I'm using ajax to populate the main panel of the page and I need to conditionally click the overlay if it exists. Of course, jquery will skip this if it's wide screen because the selector comes up empty. $("#sidenav-overlay").click(); Does this make sense? Any reason I should be hesitant on this?

Mauricio Ortensi pro commented 6 years ago

Hi cdenby! Great! It´s worked perfectly for me (I´m using MDB Pro in a SPA App with Ajax loading pages' contents). Best regards, Mauricio Ortensi, from Brazil.

Marta Wierzbicka staff answered 7 years ago


Hello, We don't have any offical workarounds. Best, Marta

ales pro answered 7 years ago


Thanks for looking into this, Marta. Any official suggested workarounds while you do your magic?

Marta Wierzbicka staff answered 7 years ago


Hello, Now I understand your problem. We will look at this and we'll fix this bug in MDB soon, because it is not so simple for us to change sidenav in this moment, but soon we will fix this. Best, Marta

ales pro answered 7 years ago


Hi, Marta! Have a look at this screencast of my full screen. BR Aleš

Marta Wierzbicka staff answered 7 years ago


Hello, I am not sure what you mean. Please describe your problem in more details and maybe send sample of your code and I will try to help you. Best, Marta

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: Yes
  • Provided link: Yes
Tags