- This topic has 11 replies, 3 voices, and was last updated 6 years, 9 months ago by Tom.
-
AuthorPosts
-
April 12, 2015 at 11:19 pm #98148Patrick
Hello Tom,
is there a way to make the delay shorter for the submenu to drop down when you hover over a menu item?
Thank youApril 13, 2015 at 9:45 am #98288TomLead DeveloperLead DeveloperHi Patrick,
The delay is handled by the hoverintent script – it’s currently set to 500ms.
To remove the delay, you can add this function:
add_action( 'wp_print_scripts', 'generate_dequeue_scripts', 100 ); function generate_dequeue_scripts() { wp_dequeue_script( 'hoverIntent' ); }
http://generatepress.com/knowledgebase/adding-php-functions/
Hope this helps ๐
April 15, 2015 at 10:48 pm #98918PatrickHello Tom,
I added the code to the functions.php in my childtheme, but as far as I see nothing changed.
The reason why the delay is bad for me is, that I have noticed that people seem to click on MenuItem to have the dropdown, but then the page behind the item opens. So I hope when there is no delay people will notice the dropdown before clickingThank you
April 15, 2015 at 10:50 pm #98919TomLead DeveloperLead DeveloperIn that case, instead of creating an empty page for the parent item, just create a “Link” with the URL: #
You can do this in “Appearance > Menus” – you’ll see the “Links” module on the left.
Using “#” as the URL will make it so clicking does nothing.
Let me know if that works for you or not ๐
April 16, 2015 at 1:30 am #98953PatrickIn that case, instead of creating an empty page for the parent item, just create a โLinkโ with the URL: #
No there is not an empty page, ther is some info on it.
For example Menuitem is Products with a page behind it which says what we offer and how. But if you hover over it you see all our products in the dropdown.
So what i have noticed is that people hover over the item for verry short until they think ok I have to click. Ususally clicking and dropdown happen at the same time, now they are surprised that a new page opens.
So I think I really need the no delay
April 16, 2015 at 5:41 am #99026PatrickBut now your code is working ok!
Thank you verry much
April 16, 2015 at 9:15 am #99143TomLead DeveloperLead DeveloperAwesome! ๐
May 12, 2016 at 1:46 am #193704MarcoHi Tom,
same issue here but the code doesn’t work for me, i think.
plugins/generate-simple-php/custom.php
<?php /** * All of your custom PHP can go in this file below this commented area * Caution: Be sure to have access to your server via File Manager or FTP in case an error occurs * Happy editing! */ add_action( 'wp_print_scripts', 'generate_dequeue_scripts', 1 ); function generate_dequeue_scripts() { wp_dequeue_script( 'hoverIntent' ); }
But the delay is still there, set to 500.
Best,
MarcoMay 12, 2016 at 9:25 am #193803TomLead DeveloperLead DeveloperAh, things have changed.
Try adding this code into the wp_footer hook in GP Hooks:
<script> jQuery( window ).load( function() { jQuery( '.sf-menu .menu-item-has-children' ).GenerateDropdownMenu.destroy(); jQuery( '.sf-menu .menu-item-has-children' ).GenerateDropdownMenu({ transition_speed: 0, open_delay: 0, close_delay: 0 }); }); </script>
May 19, 2016 at 12:35 am #195294MarcoDone. Works.
๐
Thanks Tom!May 19, 2016 at 9:43 am #195383TomLead DeveloperLead DeveloperYou’re welcome ๐
December 4, 2017 at 9:39 pm #441851TomLead DeveloperLead DeveloperJust a heads up that this jQuery function has been removed in GP 2.0 (being released this week).
The sub-menu uses CSS now, so itโs easier to adjust. Hereโs an example: https://generatepress.com/forums/topic/disable-menu-animation-on-hover/#post-436051
-
AuthorPosts
- You must be logged in to reply to this topic.