javascript - Rotating div rotating back to previous position when not meant to -



javascript - Rotating div rotating back to previous position when not meant to -

this prototype nav bar i'm building, , thought having rotating 1 in 3d aspect. works , fine except part if mouse hovered on areas after rotates, starts rotating when shouldn't (one area couple of pixels left of 2nd white bar, , when hovering above dropdowns)

i can't life of me figure out causing problem , welcome solution this?

ps: larn how particular rotation using javascript/jquery, haven't been able find successful 3d rotation it.

here raw code:

html:

<head> <link href='http://fonts.googleapis.com/css?family=droid+serif:400,700,700italic,400italic' rel='stylesheet' type='text/css'> </head> <div id="bannermaster"> <div id="banner" class="animate"> <div id="welcomemessage"> <b> welcome derp </b> </div> <div id="menunav"> <ul id="nav"> <li id="home" class="navigation"> <a href=""> <b> <div id="home2"> home </div> </b> </a> <ul> <li> <a href=""> list 1 derpface 1 </a> </li> <li> <a href=""> list 1 derpface 2 </a> </li> </ul> </li> <div class="stuffcss"> </div> <li id="aboutus" class="navigation"> <a href=""> <b> </b> </a> <ul> <li> <a href=""> list 2 derpface 3 </a> </li> <li> <a href=""> list 2 derpface 4 </a> </li> </ul> </li> <div class="stuffcss"> </div> <li id="contactus" class="navigation"> <a href=""> <b> contact </b> </a> <ul> <li> <a href=""> list 3 derpface 5 </a> </li> <li> <a href=""> list 3 derpface 6 </a> </li> </ul> </li> <div class="stuffcss"> </div> <li id="faq" class="navigation"> <a href=""> <b> f.a.q </b> </a> <ul> <li> <a href=""> list 4 derpface 7 </a> </li> <li> <a href=""> <div class="listtext"> list 4 derpface 8 </div> </a> </li> </ul> </li> </ul> </div> </div>

css:

.animate { /*-webkit-transform: rotatex(-90deg);*/ /*-webkit-transform: rotatex(-30deg);*/ } .animate:hover { -webkit-transform: rotatex(-90deg); -moz-transform: rotatex(-90deg); transform: rotatex(-90deg); } #bannermaster { position: fixed; margin: -8px 0 0 -8px; z-index: 9999999999; height: 75px; width: 100%; -webkit-perspective: 100000000000000px; -moz-perspective: 100000000000000px; perspective: 100000000000000px; -webkit-perspective-origin: center center; -moz-perspective-origin: center center; perspective-origin: center center; text-align: center; text-shadow: 0px 0px 15px #999; color: #dddddd; font-family: 'droid serif', serif; } #banner { position: relative; height: 75px; -webkit-transition: -webkit-transform 0.5s linear; -moz-transition: transform 0.5s linear; transition: transform 0.5s linear; -webkit-transform-style: preserve-3d; -moz-transform-style: preserve-3d; transform-style: preserve-3d; } #banner>div { line-height: 75px; position: absolute; height: 75px; background-position:center center; } #welcomemessage { line-height: 75px; -webkit-transform: translatez(37px); -moz-transform: translatez(37px); transform: translatez(37px); width: 100%; background: #333; box-shadow: 0 0 10px 5px #999 inset; font-size: 28px; } #menunav { -webkit-transform: rotatex(90deg) translatez(37px); -moz-transform: rotatex(90deg) translatez(37px); transform: rotatex(90deg) translatez(37px); width: 100%; background: #333; box-shadow: 0 0 10px 5px #999 inset; font-size: 18px; padding: 0; } /* dropdowns */ #nav { margin: 0 0 0 1%; } .navigation { position: relative; float: left; width: 24.4%; height: 248px; } .stuffcss { margin: 16px 0 0 0; float: left; box-shadow: 0 0 5px #fff, 0 0 2px #fff inset; height: 40px; width: 1px; } ul { width: 100%; list-style: none; padding: 0; } ul li { display: block; } ul li ul li { line-height: 43px; margin: 3px 0 0 0px; display: block; height: 40px; width: 100%; background: #111; box-shadow: 0 0 10px 2px #999 inset, 0 0 5px #999; } li ul { display: none; } ul li { text-decoration: none; text-shadow: 0px 0px 6px #999; color: #dddddd; } li:hover ul { display: block; position: absolute; } li:hover li { font-size: 13px; } ul li a:hover { color: #fff; text-shadow: 0px 0px 9px #ddd; } /* derp */ #infoderp { position: absolute; text-shadow: 0px 0px 5px #000, 0px 0px 25px #a10000; font-family: 'droid serif', serif; font-size: 12px; margin: 175px 0 0 80%; }

javascript:

edit: editted js using jason p's commented suggestion.

$('#nav .navigation').hover(function() { $(this).stop().animate({top:-12}); }, function() { $(this).stop().animate({top:0}); });

code in codepen.io: http://codepen.io/zephyr/pen/qjcpd

javascript jquery html css

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -