html5 - Horizontal menu using css transform on hover -
i'm trying make pull out navigation user hovers on "menu" handle , pulls out. i'm having success doing coming top, want boxes stacked horizontally , coming left side, moving right.
this code:
<!doctype html> <html> <head> <style> nav { position:absolute; top:-190px; } .menu:hover { -webkit-transform:translate(0px,190px); -moz-transform:translate(0px,190px); -o-transform:translate(0px,190px); -ms-transform:translate(0px,190px); transform:translate(0px,190px); -webkit-transition:ease-in-out; -moz-transition:ease-in-out; -o-transition:ease-in-out; -ms-transition:ease-in-out; transition:ease-in-out; -webkit-transition-duration: .5s; -moz-transition-duration: .5s; -o-transition-duration: .5s; -ms-transition-duration: .5s; transition-duration: .5s; } div { width:40px; height:40px; background-color:#999999; border:black solid 2px; padding:2px; font-family:helvetica; font-size:.8em; color:white; text-align:center; margin:1px; } .handle { border-radius:0px 0px 10px 10px; } div:hover { background-color:#009999; border:black solid 2px; -webkit-transform: translatex(10px); -moz-transform: translatex(10px); -o-transform: translatex(10px); -ms-transform: translatex(10px); tranform: translatex(10px); } div:active { background-color:#006699; border:black solid 2px; -webkit-transform: translatex(-10px); -moz-transform: translatex(-10px); -o-transform: translatex(-10px); -ms-transform: translatex(-10px); tranform: translatex(-10px); } </style> </head> <body> <nav class="menu"> <a href"http://www.lvc.edu/" target="_new"><div> <p>link 1</p></div></a> <a href"http://www.lvc.edu/" target="_new"><div> <p>link 2</p></div></a> <a href"http://www.lvc.edu/" target="_new"><div> <p>link 3</p></div></a> <a href"http://www.lvc.edu/" target="_new"><div> <p>link 4</p></div></a> <div class="handle"><p>menu</p></div> </nav> </body> </html>
my main issue isn't actual animation (i'm pretty sure know how figure out), it's more location of boxes , how i'd rather them horizontal instead of stacked.
sorry if confusing, guys understand!
to horizontal menu, follow 1 of innumeral tutorials around web, example one:
http://jamesowers.co.uk/css-tutorials/50/horizontal-css-list-menu/
(it customary use unordered lists menu alternatives)
to make slide in left, have change starting position offset left:
nav { position:absolute; left: [negative number corresponding width of menu];}
and sliding:
.menu:hover { ... transform:translate([width of menu],0); ... }
please note: internet explorer 8 , earlier not support css transform, mean menu wouldn't accessible (excluding still using ie under windows xp). perhaps consider using javascript/jquery instead?
Comments
Post a Comment