Add Javascript event when clicking wordpress menu

Hello!

Saw this post but couldn’t comment on it anymore, so starting a new thread because of that.

Where does this go in wordpress? I added to functions.php but throws an error…

Appreciate the help!

Hello @ahallmark,

Thanks for writing to us.

The code you have shown in the screenshot is a JavaScript code and you are adding it in the Functions.php file that is a PHP file that why you are getting an error since JS code needs to be added in JS file or you can add this code in X/Pro–>Theme Option —>JS

Or

You can create a JS file and add the JS code in the JS file then you can enqueue the JS file through the active child theme Functions.php file.

Please note that the code provided in the above thread serves as a guide only and is to help you in getting started so implementing it and maintaining the code will be out of our support scope and for further maintenance for new possible versions of the theme that may cause the customization to break, you will need to hire a developer.

Thanks for understanding

I figured it was me, thank you for the guidance!

You’re welcome.

I can’t seem to close a Navigation Modal using the JS

$(this).parentsUntil(’.x-off-canvas-content’).parent().prev().trigger(‘click’); //this closes the off canvas

What am I missing? Any help would be appreciated!

Hi @ahallmark,

We are unable to provide support for customizations under our Support Policy.

Please understand that the custom JS is just only an idea on how to get started but customizing and enhancing custom code is outside the scope of our theme support. You may seek 3rd party developers to help you with your problems or you can avail One where we can answer questions outside of the features of our theme.

Thank you for your kind understanding.

Appreciate the link to your dedicated support option, this must-have slipped my radar. I’m sold, going to sign up today.

Hi @ahallmark,

You’re welcome! If you have any other concerns or clarifications regarding our theme features, feel free to open up a new thread.

Thank you.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.