Software Archive
Read-only legacy content
17061 Discussions

Prevent background buttons from clicking while sidebar is open

madson_g_
Beginner
237 Views

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.

0 Kudos
1 Reply
Elroy_A_Intel
Employee
237 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.

0 Kudos
Reply