Im trying to create a hidden navigation bar that, when hovered over, grows in width, and when the cursor leaves the navigation bar it shrinks back down to its original width. I'm using jQuery and Parallax.js but no combination of mouseenter or mouseleave etc seems to work. As an example of what i am trying to do follow the link:
basically i want to do the same top navigation but on the left side of my page. This is my javascript:
$("#navigation").mouseenter(function(){
$("#navigation").animate({
opacity: 1,
width: "200px"
},500,"swing"
);
$("#navigation ul").animate({
opacity: 1,
},500,"swing"
);
});
$("#navigation > ul").mouseleave(function(){
$("#navigation").animate({
opacity: .75,
width: "40px"
},500,"swing"
);
$("#navigation ul").animate({
opacity: 0,
},500,"swing"
);
});
The following is my HTML:
<div id="navigation">
<ul>
<li id="aboutb">Home</li>
<li>About</li>
<li>Portfolio</li>
<li>Contact</li>
<li>Resume</li>
</ul>
</div>
I basically run into the problem of the div running through the animation more than once, or it won't stay expanded while i am hovered over the div. I do have another page wide div behind this navigation bar div.
thanks for any help!