jquery - Animated menu fades in and drops to position -
i'm trying create first animated menu.
here's image of i'm trying achieve
the arrows show want names dropping down , fading in when menu button clicked. want menu spread out across page evenly.
i've started create fiddle i'm getting no fast
here is: http://jsfiddle.net/dz0cee5l/21/
here's css
.button-container { width:100%; } .button { padding: 7px 30px; cursor: pointer; vertical-align: middle; border: 2px solid; display: inline-block; } #navcontainer ul { margin: 0; padding: 0; list-style-type: none; text-align: center; width:100%; } #navcontainer ul li { display: inline; } #navcontainer ul li { text-decoration: none; padding: .2em 1em; color: #dbd5d1; } #navcontainer ul li a:hover { color: #fff; background-color: #b93037; }
you use css transition opacity
, top
.
the menu should position: absolute
doesn't move content, , in can hidden top: 100%
, opacity: 0
, transition: opacity 1s, top 1s
animation. use jquery toggle showing class.
css:
#navcontainer { opacity: 0; position: absolute; top: -100%; transition: opacity 1s, top 1s; } #navcontainer.showing { opacity: 1; top: 100%; }
js:
$(".button").click(function() { $("#navcontainer").toggleclass("showing"); });
Comments
Post a Comment