marioloncarek / megamenu-js

Last responsive megamenu you'll ever need
MIT License
360 stars 115 forks source link

v2 Bug on mobile devices #14

Open G-dogger opened 7 years ago

G-dogger commented 7 years ago

The v2 megamenu works fine on computers, but not on mobile devices; including Android and iPhone.

When you open the menu and try to scroll up or down through sub-menu choises, the menu closes. Just the slightest touch and it closes. Please help! Thanks! Example can be found here: http://www.hannabery.com/01homev2.html

G-dogger commented 7 years ago

I found the part of the code causing the problem, just don't know how to fix it. In the JS file at end:

$(window).resize(function () { if (getWindowWidth() < responsiveBreakpoint) { $('.menu > ul').removeClass('is-shown-on-mobile'); $('.menu li').children('ul').hide(); $('.dropdown-button-text').removeClass('is-active'); $('.hamburger').removeClass('is-active'); } else { $('.menu > ul > li > ul > li').children('ul').show(); } });

If you remove this section, the menu will work fine on a phone, but then you can't use it properly on a computer when resizing browser with expanded menu - it breaks. Hope you can provide a fix!!!

born2net commented 7 years ago

yes I see the same issue, I really would like to use this menu but ya seems like a show stopper, as soon as you lift your finger from the slide, menu closes up. tx for a great menu by the way!!!!

G-dogger commented 7 years ago

Mario, I installed v2 files, but it does not work properly on smart phones. The problem is caused by the window.resize function. Hoping you can provide a fix???????????

G-dogger commented 7 years ago

Maybe you need to check for document_height; as well as width for mobiles???

leekangsan commented 7 years ago

Yes, I have the same problem. Hoping you can provide a fix???????????

pitcock commented 6 years ago

changing the line

$(window).resize(function () {

to

$(window).on("orientationchange", function() {

works for me on iPhone but has to be tested. "orientationchange" is recommended by Apple.

G-dogger commented 6 years ago

I will give it a shot, thanks

On Nov 23, 2017 4:33 AM, "pitcock" notifications@github.com wrote:

changing the line

$(window).resize(function () {

to

$(window).on("orientationchange", function() {

works for me on iPhone but has to be tested. "orientationchange" is recommended by Apple.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/marioloncarek/megamenu-js/issues/14#issuecomment-346568402, or mute the thread https://github.com/notifications/unsubscribe-auth/AXc__3XoWL-o3ceM-IeqzB-xs0wPZrB-ks5s5Tv-gaJpZM4LXJd7 .