PDA

View Full Version : keeping sub menu open on hover and close sub menu on mouse move down or scrolling



sourabhgkr
12-24-2013, 09:42 AM
here is the code for menu.


(document).ready(function(){

$("#main-nav li a.main-link").hover(function(){
$("#main-nav li a.main-link").removeClass("active");
$(this).addClass("active");
$("#sub-link-bar").animate({
height: "40px"
});
$(".sub-links").hide();
$(this).siblings(".sub-links").fadeIn();

});


$("#main-nav").mouseleave(function(){

$("#main-nav li a.main-link").removeClass("active");
$(".sub-links").fadeOut();
$("#sub-link-bar").animate({
height: "10px"
});
});
});


I want to add functionality so that

1) sub menu is hidden if mouse is moved down of main menu

2) sub menu is hidden if page is scrolled down

3) keep sub menu open on hover

Please reply. Thanks.