Site logo

Archived topic

problem with the off canvas menu does not close automatically

4 replies · Started by André on April 28, 2022

Viewing posts 1–5 of 5

off canvas menu does not close when I select a widget button (contact us button highlighted) anchored to the page. The off canvas menu remains open. How can I solve? Thanks in advance

Hi Andre,

I tried replicating the issue from my end and I can’t seem to replicate it.

See: https://share.getcloudapp.com/xQuq5b6w

I also tested on real phone and the close button still worked as expected.

Are there certain steps I missed to replicate the issue?

Moreover, if you test the occurrence of this issue on a different device, does the issue also exists? If it doesn’t, perhaps this could be a browser or device caching issue.

Kindly let us know. :)

yes, the problem is when I click the widget button at the bottom of the off canvas menu. The off canvas does not close

I inserted the anchor in the "CONTACT US" button but the off canvas menu does not close when clicked, I would like to know if there is a solution to this

I see. That’s the default behavior, and you’ll need custom code to achieve as such.

You can try creating a Hook Element hooked to wp_footer and displayed to the Entire site with this code:

<script>
var myanchor = document.querySelectorAll( '.slideout-navigation .my-anchor-button' );

	var YourOffsideCloseAction = function() {
	var url = this.getAttribute( 'href' );

	if ( '#' !== url && '' !== url && ! navigator.userAgent.match( /iemobile/i ) ) {
		setTimeout( function() {
			generateOffside.close();
		}, 200 );
	}
};
	
for ( var i = 0; i < myanchor.length; i++ ) {
	myanchor[i].addEventListener( 'click', YourOffsideCloseAction, false );
};

</script>

Hope this helps! :)

This archived topic is closed to new replies.