I am in the process of enhancing a Wordpress website by implementing a jQuery menu with sub-menus.
Below is the jQuery code snippet:
$(document).ready(function(){
$('.menu > li').hover(function(){
var position = $(this).position();
$('.sub-menu', this).css('margin-left', position.left);
$('.sub-menu', this).slideToggle('slow');
});
});
You can also find this setup on JSFiddle: http://jsfiddle.net/K96mB/
The issue I am encountering is that when hovering over a link, the sub-menu repeatedly slides in and out, resulting in a noticeable "bounce effect". Despite my efforts, I have been unable to resolve this behavior.
Furthermore, I am wondering if there is a way to ensure that only one dropdown menu opens at a time?
Your assistance on these matters would be greatly appreciated. Thank you.