javascript - CSS3 animation begin when hovering over a different element? -
i have navigation bar i'm trying 2 links animate in off-page , end next other links when hover on 1 of links in list.
current navigation links:
<div class="links"> <ul> <li> <a href="#">link 1</a> </li> <li> <a href="#">link 2</a> </li> <li> <a href="#">link 3</a> </li> </ul> </div>
and css .links:
.links ul { white-space: nowrap; list-style-type: none; position: fixed; top: 8px; left: 60%; z-index: 4; width: auto; height: 67px; } .links li { white-space: nowrap; display: inline-block; margin-right: 30px; z-index: 4; height: 40px; }
and here's relevant css, along animation have works properly:
.extralinks { position: fixed; top: 8px; left: 90%; animation-name: slidey; animation-duration: 1s; animation-timing-function: ease; animation-delay: 0s; animation-iteration-count: 1; animation-direction: normal; animation-play-state: running; /* safari , chrome */ -webkit-animation-name: slidey; -webkit-animation-duration: 1s; -webkit-animation-timing-function: ease; -webkit-animation-delay: 0s; -webkit-animation-iteration-count: 1; -webkit-animation-direction: normal; -webkit-animation-play-state: running; z-index: 4; } @keyframes slidey { 0% {left: 90%; top: 8px;} 100% {left: 40%; top: 8px;} } @-webkit-keyframes slidey /* safari , chrome */ { 0% {left: 90%; top: 8px;} 100% {left: 40%; top: 8px;} } .links li:nth-child(3) { background-color: red; }
markup .extralinks
<div class="extralinks"> <ul> <li> <a href="#">link 4</a> </li> <li> <a href="#">link 5</a> </li> </ul> </div>
i need make when hovers on "link 3" animated links slide in right , end next links. i'm not quite sure how link animation "link 3" in list. help? not opposed using javascript/jquery, i'm not well-versed in either.
thank you!
i'm not clear of goals, made assumptions , slapped jsfiddle together. used css transitions instead because assumed :hover animation , allowed sub menu return it's position.
* { padding:0; margin:0; } .links { width:100%; } .links > menu { width:100%; text-align:center; } .links menu li { display: inline-block; position:relative; padding:0.75em 1em; } .l3 .extralinks { position:absolute; top:2em; left:100%; z-index: 4; -webkit-transition:all 1s ease-in-out 0s; -moz-transition:all 1s ease-in-out 0s; -o-transition:all 1s ease-in-out 0s; -ms-transition:all 1s ease-in-out 0s; transition:all 1s ease-in-out 0s; } .l3:hover .extralinks { left:0; } .l3:hover .extralinks li { display:block; } .links li:nth-child(3) { background-color: red; } <div class="links"> <menu> <li> <a href="#">link 1</a> </li> <li> <a href="#">link 2</a> </li> <li class="l3"> <a href="#">link 3</a> <menu class="extralinks"> <li> <a href="#">link 4</a> </li> <li> <a href="#">link 5</a> </li> </menu> </li> </menu> </div>
Comments
Post a Comment