Sunday, 15 August 2010

javascript - jQuery: animate to height of div -



javascript - jQuery: animate to height of div -

i have function:

function fixedfeesize(i){ var num1 = $('#num' + i); if (num1.hasclass("extended")) { num1.stop(true, true).animate({height: '59px'},500); num1.removeclass("extended"); }else{ var height = 0; num1.animate({height: '360px'},500); num1.addclass("extended"); } homecoming null; }

which expands / contracts div, struggling expand height of div each div (there 10+) going different heights.

i tried num1.animate({height: 'auto'},500); has not worked.

is effect you're after?

jquery(".menu a").mouseenter(function(){ jquery(this).stop().animate({ height: 200, opacity: 0.5 }, 1000, "linear"); }); jquery(".menu a").mouseleave(function(){ jquery(this).stop().animate({ height: 18, opacity: 1 }, 1000, "linear"); });

here's jsfiddle: http://jsfiddle.net/kkazx/1/

for farther reading, take @ total documentation of .animate function: http://api.jquery.com/animate/

you can combine effects create kinds of fantastic, standard-compliant effects.

javascript jquery

No comments:

Post a Comment