megamenu-js
megamenu-js copied to clipboard
how i change hover menu to click
hello
how i change hover menu to click in megamenu ??
You want the dropdowns to be opened on click and not on hover? Like on mobile?
no , i need to after click a menu then open megamenu , in default when hover mouse then it open
sorry but I dont really know what are you trying to ask me, please explain me again
i need to click menu in windows not in mobile ! in large size then instance hover mouse open submenu click it then open sub menu .
excuse for bad english
i have no idea what are you talking about, sorry, here is the version of the menu where you click to open menus on every width (large and mobile) : http://codepen.io/riogrande/pen/pbVjqm
What i did i simply renamed .hover to .click on line 19.
Did this fixed your problems?
ok it work , but have a bug, after click to outside menu not close.
its not a bug when this is not a feature :) why dont you try to fix this, its not really that hard, 90% its allready fixed on stack overflow :)
http://stackoverflow.com/questions/1403615/use-jquery-to-hide-a-div-when-the-user-clicks-outside-of-it
http://stackoverflow.com/questions/152975/how-to-detect-a-click-outside-an-element
I googled " click outside jquery "
ok
$(window).click(function() {
//Hide the menus if visible
});
$('#menucontainer').click(function(event){
event.stopPropagation();
});
$(".menu > ul > li").click(function (e) {
e.stopPropagation(); // for stop click outside the menu
if ($(window).width() > 943) {
$(this).children("ul").stop(true, false).fadeToggle(0);
e.preventDefault();
}
});
when click to windows
$(window).click(function() { $(this).children("ul").fadeToggle(150); });
not close
If understood correctly:
//If width is more than 943px dropdowns are displayed on hover
$(".menu > ul > li").click(function () {
if ($(window).width() <= 2000) {
$(this).children("ul").fadeToggle(0);
}
}); jQuery(function($){ $(document).mouseup(function (e){ if ($(window).width() > 1100) var div = $(".menu > ul > li > ul"); if (!div.is(e.target) && div.has(e.target).length === 0) { div.hide(); } }); });
http://codepen.io/riogrande/pen/pbVjqm
Hello, how do I make sure that when I click on another tab the other one closes automatically? It's becoming a real problem for me, it's been 2 weeks since I fight with it
Je sais nous somme en 2020 LOL
one approach would be to add class on click, then write a logic which would firstly on click find an element with that class and close the dropdown, then you would add a class to new one and open it @mendy51