css - Text hover jquery animation -



css - Text hover jquery animation -

i trying accomplish text hover effect navigation links, on mouseenter, text in link slides (briefly disappears), text changes, slides down. on mouseleave, original text comes back.

similar next site navigation links has:

http://wrapbootstrap.com/preview/wb08808b5

this tried, seems fire more 1 time on mouseenter , animation never carried out described above:

<div class="navbar-right" > <ul class="nav navbar-nav" > <li><a href="#" class="link">cars</a><span class="nav_anim">to drive</span></li> <li><a href="#" class="link">wood</a><span class="nav_anim">to chop</span></li> <li><a href="#" class="link">steak</a><span class="nav_anim">to eat</span></li> </ul> </div>

jquery

var orig, anim; $('.link').mouseenter(function () { orig = $(this).text(); anim = $(this).parent().children('.nav_anim').text(); $(this).stop(true,false).slideup(300).text(anim).slidedown(300); }).mouseleave(function(){ $(this).stop(true,false).slideup(300).text(orig).slidedown(300); });

jsfiddle: http://jsfiddle.net/f0raekme/1/

$("ul li").hover( function() { first = $(this).children('a.link'); $(first).animate({ margintop: "-20px", opacity: '0' }, 300); }, function() { $(first).animate({ margintop: "0px", opacity: '1' }, 300); } );

and, changed css: (fixed height)...

li { display:block-inline; float:left; border:1px solid grey; width:100px; height:20px; overflow:hidden; list-style-type:none; text-align:center; }

demo: http://jsfiddle.net/f0raekme/3/

jquery css css3 jquery-ui css-transitions

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 -