开发者

JQuery Height of Div to increase in size Vertically

I am trying to get a div to increase in height but moving upwards instead开发者_Python百科 of downwards, this happens almost every second (on a realtime event):

 height++;
 $("#bar").height(height);

But right now the top of the box stays in the same position while the bottom of the bar goes down. I want the bottom of the bar to stay where it is while the top moves up with each event. I hope this makes sense, any advice would help thank you!

UPDATE: The CSS of the bar:

#bar
{
 width:20px;
 height:0px;
 display: block;
 background-color: blue;
}


The div will animate bottom to top unless you attach it by the bottom css style. For example

http://jsfiddle.net/robert/BWwyf/

div {
    position: absolute;
    bottom: 0;
}

then

$('div').slideUp();

This will animate from the top to the bottom


Pete ,

Make it position absolute and give the bottom some pixel, so it always stays there

#bar
{
 width:20px;
 display: block;
 background-color: blue;
 position:absolute;
 bottom:2px;

}

make this parent div relative

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜