Close menu on click outside of menu area

  • cme
  • cme's Avatar Offline Topic Author
  • New Member
  • New Member
  • Posts: 9
  • Thanks: 0

Close menu on click outside of menu area was created by cme

Posted 8 years 7 months ago #29243
Hi,

I am using Accordeon Menu CK for my main navigation. The event to open is set to "click" in order to support touch devices. Everything is running fine, but I would really like to close the menu if the user clicks anywhere outside of the menu and not just if the user clicks on the top level item again. Any hints? I couldn't find anything in the manual.

Best regards
cme
by cme

Please Log in or Create an account to join the conversation.

Replied by ced1870 on topic Close menu on click outside of menu area

Posted 8 years 7 months ago #29248
Hi
I have already tried to implement this feature, but without success...
Remind me next week, I will give it a new try :)
CEd

Joomlack Webmaster and Developer

by ced1870

Please Log in or Create an account to join the conversation.

  • cme
  • cme's Avatar Offline Topic Author
  • New Member
  • New Member
  • Posts: 9
  • Thanks: 0

Replied by cme on topic Close menu on click outside of menu area

Posted 8 years 7 months ago #29381
Hi CEd,

friendly reminder, any progress? ;)

cme
by cme

Please Log in or Create an account to join the conversation.

Replied by ced1870 on topic Close menu on click outside of menu area

Posted 8 years 7 months ago #29442
Hi
no progress for now ... :(
I'm on a development that takes a lot of brain faculties ;) and many people are back from holidays.
I note your request on my todolist, and I will let you know when I will be able to have a look at this
CEd

Joomlack Webmaster and Developer

by ced1870

Please Log in or Create an account to join the conversation.

  • cme
  • cme's Avatar Offline Topic Author
  • New Member
  • New Member
  • Posts: 9
  • Thanks: 0

Replied by cme on topic Close menu on click outside of menu area

Posted 8 years 6 months ago #29944
Hi CEd,

Guess you are still pretty busy. What do you think about an approach like this:
Code:
$( "body" ).click(function( event ) { if(!event.target.hasClass("toggler")){ accordeonmenuInit(); }

All of your menu elements contain the class "toggler". If the user clicks on one of those, nothing happens. If any other element is clicked, would it be possible to simply reinitialize the whole menu?

If not, one could check, if any of your li items contain the "open" class and invoke your "togglemenu" function for that.

Let me know what you think.

cme
by cme

Please Log in or Create an account to join the conversation.

Replied by ced1870 on topic Close menu on click outside of menu area

Posted 8 years 6 months ago #29948
Hi
yes I'm quite busy :)
you can try to fire the click event like this
Code:
$('li.accordeonck.open').trigger('click');
(not tested by my side)
CEd

Joomlack Webmaster and Developer

by ced1870

Please Log in or Create an account to join the conversation.

Time to create page: 0.656 seconds

Fast and powerful creation, customizable and responsive.

Read More

We have 509 guests and no members online