Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1
  • 2

TOPIC: Close menu on selection

Close menu on selection 23 May 2015 10:22 #27464

Hi,

I'm using Maximenu with the pushdown theme and on click activation. The menu items make AJAX calls to display the pages.

Because the page doesn't reload the menu stays open after a selection is made. I need a way to auto close it.

I can put a few lines of code in the AJAX callback if this is the easiest way.

I would appreciate your advice on what this code should be.

Thanks

JM

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

Close menu on selection 24 May 2015 09:41 #27472

  • ced1870
  • ced1870's Avatar
  • Offline
  • Administrateur
  • Administrateur
  • Posts: 17671
  • Karma: 391
  • Thank you received: 2264
Hi
I have to make some tests by my side to check this, as this is the first time someone ask this. :)
Remind me on thursday, I will have a look
CEd

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

Joomlack Webmaster and Developer

Close menu on selection 29 May 2015 14:47 #27612

OK thanks!

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

Close menu on selection 31 May 2015 08:45 #27624

  • ced1870
  • ced1870's Avatar
  • Offline
  • Administrateur
  • Administrateur
  • Posts: 17671
  • Karma: 391
  • Thank you received: 2264
looking again at your request I think that you can fire a click event on the link so that the menu will react and then close. You just have to point to the item that has the submenu opened. Is it clear ?

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

Joomlack Webmaster and Developer

Close menu on selection 31 May 2015 11:43 #27625

I probably didn't phrase the question very well. Firing a click event on the active link should of course close the menu.

The difficulty I'm having is getting a reference to the active maximenuck link. My understanding is that Joomla adds the active class to the current menu item but a.active doesn't work. I can fire an event on all "a" links but I don't want to double click everything!

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

Close menu on selection 31 May 2015 11:52 #27627

Actually I don't think it will work. If I click the link a second time it just reloads the page. It doesn't close the menu.

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

Close menu on selection 31 May 2015 11:55 #27628

It closes if you click its parent. So I guess what I need it a reference to the parent of the current active link.

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

Close menu on selection 31 May 2015 12:35 #27630

  • ced1870
  • ced1870's Avatar
  • Offline
  • Administrateur
  • Administrateur
  • Posts: 17671
  • Karma: 391
  • Thank you received: 2264
the active class is added to the <li> element, so you can get it with something like
"li.active > a"

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

Joomlack Webmaster and Developer

Close menu on selection 31 May 2015 13:09 #27631

The event below only fires when you click the home icon. Clicking any other menu items, either parent or child does not fire the event.

jQuery("li.active > a").click(function() {

alert("firing");
});

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

Close menu on selection 31 May 2015 13:12 #27632

  • ced1870
  • ced1870's Avatar
  • Offline
  • Administrateur
  • Administrateur
  • Posts: 17671
  • Karma: 391
  • Thank you received: 2264
here you are catching the click event, not fire it
give me your url to check

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

Joomlack Webmaster and Developer
  • Page:
  • 1
  • 2
Time to create page: 0.351 seconds

Fast and powerful creation, customizable and responsive.

Read More

Qui est en ligne

We have 241 guests and no members online