sideNav Toggle Open/Close


Topic: sideNav Toggle Open/Close

acscreative asked 6 years ago

Im trying to have my sidenav button work like a toggle. Click once and it opens and click again and it closes. 

I know in your demo you have the button covered up when its open so just clicking on the background overlay works fine there but the way I have it set up is the button will always be visible. Right now it just re-does to open part and the bg just gets darker every time. 

Here is a snippet I found that is my exact problem and even found a couple different topics on it. I see you might be working on a fix but maybe we can have a small snippet of JS to just put in our file for a work around for now? Kind of need a solution quick for this build.

Thanks for the time


Pytchoun answered 6 years ago

I looking for also this !


Piotr Glejzer staff answered 6 years ago

Hi guys,

here is some workaround about your problem 

https://mdbootstrap.com/snippets/jquery/piotr-glejzer/120704

Can you check it?

Best,

Piotr


acscreative commented 6 years ago

Hi Piotr,

Thanks for the reply.

I have seen that one but it will not fix my issue. I need to be able to click on the same button that I used to open the nav with.

I have tried some code that would hook into the closing function that fires when you click the overlay the same you sent. I was trying to create a if then statment that would make the open button a toggle or something like that but with no luck. 

Really hopping we can get some kind of hack that will give us a solution until you have something that is fully baked in.

Thanks

-Dan


Pytchoun commented 6 years ago

if you find one share with me


Piotr Glejzer staff commented 6 years ago

We don't have that solution for now. SideNav is constructed how you see. If you click on button SideNav is forward to and covering the button. We have on our list to do to 'rewrite' SideNav and fix all bugs, but I can't give you ETA when we will do that. Sorry about that. 

.button-collapse{
z-index:3000;
}
If you try to use this CSS code you will have button always visible but how I said, this is not possible for now have a button toggling open/close. 

Pytchoun answered 6 years ago

When the sidenav is open other element are in background and can't be used. How to fixe that ?


Piotr Glejzer staff commented 6 years ago

Did you try use somehow 

$('#sidenav-overlay').remove();
 
or something like that when you click on the button?

Pytchoun commented 6 years ago

no i didn't i used your code


Piotr Glejzer staff commented 6 years ago

Ok. But It's not a bug. That is an assumption about sidenav. If you click on button sidenav is moving and cover all other elements. 


mauldraine answered 6 years ago

Here is how I solved this issue for a new web site I'm working on ...

https://mdbootstrap.com/snippets/jquery/mauldraine/426513

Please enjoy!


Piotr Glejzer staff commented 6 years ago

Thanks for your idea. Have a nice day.


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.5.15
  • Device: LapTop
  • Browser: Chrome
  • OS: OS
  • Provided sample code: No
  • Provided link: Yes
Tags