Community
cancel
Showing results for 
Search instead for 
Did you mean: 
madson_g_
Beginner
63 Views

Prevent background buttons from clicking while sidebar is open

The code below helps me to toggle sidebar.

$(document).on("click", "#opensidebar_btn", function(evt)
    {
        uib_sb.toggle_sidebar($("#sidebar"));
        
    });

and the code below prevents sidebar from closing when the click is inside the sidebar.

$(document).on("click", "#pageareas", function(evt)
    {
        $("#sidebar").click(function(evt){ 
            evt.stopPropagation(); 
        });
        
        uib_sb.close_sidebar($("#sidebar"));
        
    }); 

I have some buttons on page and I can´t disable their click events while sidebar is open. I want to close the sidebar before any click event on that buttons, even if I click over them. I don´t want to create an overlay div to do that. Is there a method for that?

I tried some conditions like if .is('visible'), .is('visible').length > 0, .attr("aria-expanded"), .isShown but nothing has worked because sidebar seems to be always open, even if it is closed.

Tags (2)
0 Kudos
1 Reply
Elroy_A_Intel
Employee
63 Views

I recommend that you create your own variable to declare a state for the side bar and invert it when it is closed or open. This would allow you to keep track of it yourself.

Reply