javascript - How to animate div using jQuery to the height of another div -
i have div called .a
coded height:auto
has height rendered based on text contained within. have div on page called .b
need animate down using jquery based on height of first div, .a
.
i have attempted using following jquery function, without luck. idea have jquery ascertain height of .b
apply padding .b
, not grabbing correct height. have tried using 'margintop'
jquery('div.a').animate({'paddingtop': jquery('div.b').height()},500);
desparate help! pay up-votes , generous compliments.
i think need .outerheight(true)
:
jquery('div.a').animate({ paddingtop : jquery('div.b').outerheight(true)},500);
description .outerheight()
docs
get current computed height first element in set of matched elements, including padding, border, , optionally margin. returns integer (without "px") representation of value or null if called on empty set of elements.
note:
the top , bottom padding , border included in .outerheight() calculation; if includemargin argument set true, margin (top , bottom) included.
Comments
Post a Comment