Show off-canvas without trigger (Desktop)

Is it possible to display the off-canvas element in the desktop view permanently and without a trigger. Only from the tablet view I want to open the off-canvas element with a trigger.

Similar to what is done here

Just add the class .brx-open to the .brxe-offcanvas element :slight_smile:

2 Likes

Thanks Daniele, it works :slight_smile:

I am so dumb and tried all the time with .open and .active

1 Like

If there are any other people who would like to implement something similar, here is a possible solution. In the script, the class .brx-open is either added or removed from a certain screen size. Works quite well at first sight.

window.onload = function() {
    jQuery(document).ready(function($) {
        function checkWidth() {
            var windowSize = $(window).width();

            if (windowSize <= 991) {
                $('.brxe-offcanvas').removeClass('brx-open');
            } else {
                $('.brxe-offcanvas').addClass('brx-open');
            }
        }

        checkWidth();
        
        $(window).resize(checkWidth);
    });
}

If the JS code is not executed you can fix it with this PHP Snippet.

wp_enqueue_script( 'jquery' );