Site logo

Archived topic

generate-slideout-menu trigger to open with javascript

3 replies · Started by Randy on February 1, 2021

Viewing posts 1–4 of 4

Hi!

If I want to trigger the generate-slideout-menu to open with javascript, can you tell me what classes I would need to manipulate?

I tried document.querySelector('#generate-slideout-menu').classList.add('is-open'); which works well, except that it doesn't display the slideout-overlay, so there must be a class or something I am missing, or a different one I should use maybe to make both the generate-slideout-menu and the slideout-overlay visible please?

Thank you!

Hi there,

The script adds in offside-js--is-open class to the body tag as well so you may also have to add: document.querySelector('body').classList.add('offside-js--is-open'); to your script.

This is required as the CSS to show the overlay is this:

.offside-js--is-open .slideout-overlay {
    visibility: visible;
    opacity: 1;
}

Meaning if offside-js--is-open class is present within the body tag, this will apply, hence classList.add('offside-js--is-open').

Great thanks! Looks like I might also have to add offside-js--is-right slide-opened classes to body in order to get the slideout close button to appear, right?

Great thanks! Looks like I might also have to add offside-js--is-right slide-opened classes to body in order to get the slideout close button to appear, right?

Yes thats right. or offside-js--is-left if its coming in from the left depending on what the offcanvas setting.

This archived topic is closed to new replies.