Jump to content

blocktopmenu wont work on mobile


Recommended Posts

 

Hi fellow programmers, I installed(mySiteLink) a template from TemplateMonster(link)

 

Everything is working fine despite my blocktopmenu on mobile.

 

My prestashop is V 1.6.0.6 

 

 

Wen I click the "+" icon on categories, it does not expand the submenu itens.

 

The original template works fine.

 

 

Some things that I struggling to figure out in presta code so I can solve this problem, and any answers would be appreciated:

 

 

1. Which is function is triggered when I press the "+" button on blockTopMenu?That function is not changing the "display" attribute of the submenu items to "block" 

 

 

2. Can I enable de default theme only for mobile? The default theme works fine as well.

 

Thanks in advance.

post-811391-0-66299800-1405609672_thumb.png

  • Like 1
Link to comment
Share on other sites

Got it working, I changed 

file 

themes/torrevermelha/js/modules/blocktopmenu/js/blocktopmenu.js

 

function responsiveMenu()

{
   if ($(window).width() <= 767 && responsiveflagMenu == false)
{
menuChange('enable');
responsiveflagMenu = true;
}
else if ($(window).width() >= 768)
{
menuChange('disable');
responsiveflagMenu = false;
}
}
 
 
It was document before.. chaged it to window and got it working 
$(document).width()  was return a value much bigger.. 
  • Like 4
Link to comment
Share on other sites

  • 4 months later...
  • 4 months later...
  • 4 months later...

Hi to All! I have presatshop  1.6.0.14 and no solution worked for me. My problem was at /themes/default-bootstrap/js/modules/blocktopmenu/js/blocktopmenu.js from line 26 to 37. There was a ".sf-contener" class selector that does not exist in the template code. I removed "sf-contener" and everything worked for me.

 

var responsiveflagMenu = false;
var categoryMenu = $('ul.sf-menu');
//var mCategoryGrover = $('.sf-contener .cat-title');
var mCategoryGrover = $('.cat-title');
 
$(document).ready(function(){
categoryMenu = $('ul.sf-menu');
//mCategoryGrover = $('.sf-contener .cat-title');
mCategoryGrover = $('.cat-title');
responsiveMenu();
$(window).resize(responsiveMenu);
});
 
Hope helps to others.
 
Regards!
Link to comment
Share on other sites

  • 1 year later...

Thanks pabloliracecilio !

 

I just spent a few hours debugging why blocktopmenu was messing on some pages but not all ... You gave me the solution !

My beloved client copy pasted in a RTE field some html code including good old <table ... width="1000">

 

so the condition $(document).width() <= 767 was never ok on that precise page,

so desktopInit() was called whatever the device, mobileInit() was never called,

so the click on "categories" could not trigger the expected expected slideToggle() effect...

 

Using the condition

if ($(window).width() <= 767 ... 

instead of

if ($(document).width() <= 767 ... 

solves this bug.

Link to comment
Share on other sites

  • 1 year later...
On 17.07.2014 at 11:29 PM, pabloliracecilio said:

Got it working, I changed file
themes/torrevermelha/js/modules/blocktopmenu/js/blocktopmenu.js

function responsiveMenu()
{
   if ($(window).width() <= 767 && responsiveflagMenu == false)
{
menuChange('enable');
responsiveflagMenu = true;
}
else if ($(window).width() >= 768)
{
menuChange('disable');
responsiveflagMenu = false;
}
}


It was document before.. chaged it to window and got it working
$(document).width()  was return a value much bigger..

 

Thanks a lot man!!!

Edited by Dmytro Korolkov (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...