Reputation: 377
There is some straight jQuery that hides the open div when clicked not shown, but still adds the height to the navigation to make it seem like it is dropping down.
This script works okay:
<script>
$(document).ready(function(){
$("#openNav").click(function(){
$("#nav").animate({height: "200px"});
});
$("#closeNav").click(function(){
$("#nav").fadeOut();
$("#nav").animate({height: "100px"});
});
});
</script>
This doesn't animate at all when clicked:
<script>
$(document).ready(function(){
$("#openNav").click(function(){
$("#nav").animate({top: "+100px"});
});
$("#closeNav").click(function(){
$("#nav").fadeOut();
$("#nav").animate({height: "-100px"});
});
});
</script>
Upvotes: 0
Views: 40
Reputation: 9777
You'd need the DOM to have position:relative
or absolute
in order for positional properties like left
, top
, etc. to take effect in css.
Upvotes: 1
Reputation: 157
#nav
should have position: relative
or position: absolute
for top
animation
Upvotes: 0