javascript - Create expanding animation on <li> button -


i have created menu bar using ul list.

when hovering on 1 of 4 links changed colour, expanding animation similar http://jsfiddle.net/xntzq/6/ not changing shape, changing colour , possibly expanding shape.

below html , css code.

html:

<div class="menu">     <ul>         <li id="active"><a href="index.html">home</a></li>         <li><a href="portfolio.html">portfolio</a></li>         <li><a href="gallery.html">gallery</a></li>         <li><a href="contact.html">contact</a></li>     </ul> </div> 

css:

    .menu {     width: 960px;     height: 35px;     text-align: center;     background-color: #17ade0;       }  .menu ul {     height: auto;     padding: 8px 0px;     margin: 0px; }     .menu li {     display: inline;      padding: 20px;  }  .menu {     text-decoration: none;     color: #fff;     padding: 8px 20px 6px 20px;     -moz-border-radius-topright: 50px;     -webkit-border-top-right-radius: 50px;     -moz-border-radius-bottomright: 50px;     -webkit-border-bottom-right-radius: 50px;     -moz-border-radius-topleft: 50px;     -webkit-border-top-left-radius: 50px;     -moz-border-radius-bottomleft: 50px;     -webkit-border-bottom-left-radius: 50px; }  .menu a:hover {     color: #17ade0;     background-color: #fff; }  .menu a:active {     color: #17ade0;     background-color: #fff; }  #active {     color: #17ade0;     background-color: #fff; }  .menuinfo {     width: 960px;     height: 35px; } 

if require more of code let me know.

you can tweak 4 transition declaration set animation each transformation custom order, delays , timing functions:

.menu a:hover {   ...   transition-property: background-color, border-radius;   transition-duration: 0.5s, 0.3s;   transition-delay: 0, 0.2s;   transition-timing-function: ease-out, ease; } 

if want full browser compatibility, should call each -moz, -o, -webkit , standard transitions.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -