This topic is: not resolved
- This topic has 0 replies, 1 voice, and was last updated 6 years ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to collapse mobile menu on li or anchor click – infinity pro
Tagged: mobile menu infinity pro
Hello all,
I have been trying to change some JS to change the mobile menu functionality so that it closes once the user clicks an anchor or li item in the menu. At the moment, it stays open until you click the actual hamburger menu which is not very user friendly. I would also like to use a stop-scroll function so that while the mobile menu is open, the content in the background doesn't scroll until the menu is closed.
As far as I know, I've done this right but for the life of me I can't get it to work! Your help is SUPER appreciated (I've been working on this for days... >.< please put me out of my misery)
See code below:
//added to top of responsive-menus.js
$(function () {
$('#menu-main-top li').click(function () {
$('nav.nav-primary').slideToggle('fast');
});
});
//edited function below--
* Action to happen when the main menu button is clicked.
*/
function _mainmenuToggle() {
var $this = $(this);
_toggleAria($this, 'aria-pressed');
_toggleAria($this, 'aria-expanded');
$this.toggleClass('activated');
$('nav.nav-primary').slideToggle('fast'); //changed to .nav-primary since we're not toggling .nav-secondary
}
© 2024 WPEngine, Inc.