-
AuthorPosts
-
July 14, 2014 at 11:28 pm #291291
Hello,
Now all submenu’s are displayed when the cursor hovers on the top-menu/parent.
I want to show the submenu only when submenu parent is clicked.
http://test.contrario.nl
Is there a css code that results in this behavior?
The reason is that our users don’t expect that the top-menu-items also are page’s and not a title for the submenu.Any suggestions?
Thank you!
Alfred
July 15, 2014 at 4:13 am #291367Hi alfredscholten!
Thank you for using the theme.
Edit js > avia.js, find this code on line 1063:
currentLink.bind('mouseenter', function() { sublist.stop().css({visibility:'visible'}).animate({opacity:1}); });
Replace it with:
currentLink.bind('click', function() { event.preventDefault() sublist.stop().css({visibility:'visible'}).animate({opacity:1}); });
Cheers!
IsmaelJuly 15, 2014 at 11:47 pm #291876Hi Ismael!
Thanks for the code.
This works fine, but… now the link to the page of the top-menu doesn’t open.Is there an other way? So that the top-menu-page will load/open and the submenu’s only shows when this page is loaded?
Regards,
Alfred
July 16, 2014 at 1:08 am #291893February 10, 2015 at 4:20 am #393469Gday all
I found that when I used the code supplied by Ismael, the parent click did actually open the parent page (while simultaneously revealing the submenu on same click).
I’d like the click to disable the parent page from opening, so only the submenu items can be revealed and chosen.
Does anyone know an additional line to achieve that? That is, to disable the parent page from opening? I tried using a ‘Link’ with # for the url but then the click didn’t reveal the submenu.
Thanks for any help you are able to give me.
cheers
Darryl
February 10, 2015 at 5:45 am #393482Hi Darryl,
I tried using a ‘Link’ with # for the url but then the click didn’t reveal the submenu.
This normally works, can you please create us a WordPress administrator account? post it here as a private reply.
Regards,
JosueFebruary 10, 2015 at 5:55 am #393488This reply has been marked as private.February 10, 2015 at 7:49 am #393530Hi Darryl!
I tested it a few times and the submenu shows when the “About us toggle submenu test” item is clicked – http://screencast.com/t/TJlBPceZwAy
Best regards,
JosueFebruary 10, 2015 at 8:10 am #393536Ah, that’s fascinating Josue. I didn’t check other browsers and this has reminded me to do so. I’m on a MacBook, Firefox latest version (35.0.1) and it doesn’t work. Though Safari and Chrome do. Does that mean Firefox may need additional js that functionally does the same thing?
Edit: I just read some info on a Mozilla forum that might help: ” going to the top of the page is what href=”#” is supposed to do. If you have a JavaScript event and want to suppress the other link action, use “return false” at the end of it.”
Does that make sense to you Josue? I don’t know how to do javascript, so I’m not sure how to test it.
cheers
Darryl- This reply was modified 9 years, 9 months ago by itchybrain.
February 12, 2015 at 12:50 pm #394954Hi!
Try to use this code instead:
currentLink.bind('click', function(event) { event.preventDefault() sublist.stop().css({visibility:'visible'}).animate({opacity:1}); });
Remove browser cache then reload the page.
Cheers!
IsmaelMarch 20, 2017 at 3:10 pm #763663Hi there,
I tried to use the code that Ismael provided in his first reply but the submenu is still opening by hover.
Has anything changed that makes this code not work in the current version of enfold?BR, Niemitz
March 23, 2017 at 7:23 pm #765680Hi Niemitz,
It is a normal practice, that the menu opens on hover, no extra effort by the user needed to see submenu and then yet another action to close the menu.
But if you really want to change that code still works, I checked your avia.js (here http://www.bios-tec.de) and it does not seem to have that changed. Is this the site where you’re trying to implement it or is there a different site you’re working on?
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.