html - CSS3 animate slide/hide navigation to influence other elements -



html - CSS3 animate slide/hide navigation to influence other elements -

i have smooth animated transition of 1 & 2, when 1 triggered display. have accomplished here: http://codepen.io/jacksonbeale/pen/epjcs using negative top margin, problem height of 1 vary depending on number of items in navigation, not work me.

nav { margin-top:-95px; width:100%; box-sizing:border-box; z-index:5; -webkit-transition: 1s ease-in-out; -moz-transition: 1s ease-in-out; -o-transition: 1s ease-in-out; transition: 1s ease-in-out; &.showmenu { margin-top:0; } }

my current project not allow me utilize jquery, , js needs written developer. have command on html & css. seem running in issue bit great if offer suggestion on pure css method accomplish need.

you :

add container around menu , content position content absolutely then, container has height of menu (content out of flow position:absolute;) can utilize translatey togggle menu in , out translatey(-100%)/translatey(0)

demo

html :

<div class="test"> <div><span class="menulink">menu</span></div> <div class="content"> <nav> <ul> <li>one</li> <li>two</li> <li>three</li> <li>three</li> <li>one</li> <li>two</li> <li>three</li> <li>three</li> </ul> </nav> <div>content</div> </div> </div>

css : (sorry i'm not used scss)

.test { width:400px; position:relative; > div, nav { border:3px solid #ccc; } > div:first-child { height:30px; z-index:10; background:teal; position:relative; z-index:1; span { float:right; display:table; height:100%; &:hover { cursor:pointer; } } } nav { width:100%; box-sizing:border-box; z-index:5; &.showmenu { margin-top:0; } } } .content > div{ min-height:200px; position:absolute; left:-3px; top:100%; width:100%; border:3px solid #ccc; } .content{ z-index:0; transform: translatey(-100%); -webkit-transform: translatey(-100%); -webkit-transition: 1s ease-in-out; -moz-transition: 1s ease-in-out; -o-transition: 1s ease-in-out; transition: 1s ease-in-out; } .content.showmenu{ transform: translatey(0); -webkit-transform: translatey(0); }

jquery :

$( ".menulink" ).click(function() { $( ".content" ).toggleclass( "showmenu" ); });

html css css3 css-animations

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -