Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jQuery Superfish Menu Plugin #185

Open
esk2004 opened this issue Feb 16, 2021 · 0 comments
Open

jQuery Superfish Menu Plugin #185

esk2004 opened this issue Feb 16, 2021 · 0 comments

Comments

@esk2004
Copy link

esk2004 commented Feb 16, 2021

Hi All
I was just wondering if it's possible to have the superfish mobile menu close on clicking a link rather then having to manually close it with the X on the right side......

megamenuToggle = function() {
	if ( $(window).width() > 991 ) {
		$('#megamenu').removeClass('megamenu_mobile').addClass('megamenu_desktop');
		$('#megamenu_level__1').superfish();
		$('#megamenu .level_1, #megamenu .level_2, #megamenu .level_3').removeAttr('style');
		$('#megamenu_mobile_toggle, .megamenu_trigger').off('.mobileMenu').removeClass('off active');
		$('#megamenu_level__1, #megamenu_mobile_close').removeClass('on');
		$('html, body').css('overflow', 'auto');
		mobFlag = 0;

	}
	else {
		$('#megamenu_level__1, #megamenu_mobile_close').hide();
		$('#megamenu').removeClass('megamenu_desktop').addClass('megamenu_mobile');
		$('#megamenu_level__1').superfish('destroy');
		if ( mobFlag == 0 ) {
			menuMobile();
			mobFlag = 1;
		};
	};
};

menuMobile = function() {
	$('#megamenu_mobile_toggle').on('click.mobileMenu', function(){
		$('#megamenu_level__1, #megamenu_mobile_close').show().addClass('on');
		$('html, body').css('overflow', 'hidden');
	});

	$('#megamenu_mobile_close').on('click', function() {
		$('#megamenu_level__1, #megamenu_mobile_close').removeClass('on');
		$('html, body').css('overflow', 'auto');
	});

	$('.megamenu_trigger').on('click.mobileMenu', function() {
		var targetMenu = '#' + $(this).data('submenu');
		$(targetMenu).slideToggle(300);
		$(this).toggleClass('active');
		return false;
	});

};

appreciate any help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant