MonsterM Posted August 14, 2014 Share Posted August 14, 2014 Hello, I wonder if somebody knows how to change how the Top Menu opens in mobile devices. I don't like that the "Categories +" opens to show Subcat as soon as I touch it. If I just want to scroll down on the site and incidentally put my finger on the top menu it will open. I want it to open if I click it, not if I touch it. It would be great if someone could help me with this issue. Kind regards Link to comment Share on other sites More sharing options...
MonsterM Posted August 16, 2014 Author Share Posted August 16, 2014 No one else that find this annoying? I really think that this feature is something that PrestaShop must change. The subcategories works just fine, but as soon as one touch the top menu, it will open. Don't like it at all. It would be wonderful if someone had an idea how to fix this problem. Link to comment Share on other sites More sharing options...
MonsterM Posted August 19, 2014 Author Share Posted August 19, 2014 (edited) Fixed it myself, wasn't to hard. Delete "touchstart" in the blocktopmenu.js, just have click for the mobileInit. function mobileInit() { categoryMenu.superfish('destroy'); $('.sf-menu').removeAttr('style'); mCategoryGrover.on('click', function(e){ $(this).toggleClass('active').parent().find('ul.menu-content').stop().slideToggle('medium'); return false; }); $('.sf-menu > li > ul').addClass('menu-mobile clearfix').parent().prepend('<span class="menu-mobile-grover"></span>'); $(".sf-menu .menu-mobile-grover").on('click', function(e){ var catSubUl = $(this).next().next('.menu-mobile'); if (catSubUl.is(':hidden')) { catSubUl.slideDown(); $(this).addClass('active'); } else { catSubUl.slideUp(); $(this).removeClass('active'); } return false; }); $('#block_top_menu > ul:first > li > a').on('click', function(e){ var parentOffset = $(this).prev().offset(); var relX = parentOffset.left - e.pageX; if ($(this).parent('li').find('ul').length && relX >= 0 && relX <= 20) { e.preventDefault(); var mobCatSubUl = $(this).next('.menu-mobile'); var mobMenuGrover = $(this).prev(); if (mobCatSubUl.is(':hidden')) { mobCatSubUl.slideDown(); mobMenuGrover.addClass('active'); } else { mobCatSubUl.slideUp(); mobMenuGrover.removeClass('active'); } } }); } Edited August 19, 2014 by MonsterM (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts