tags:

views:

116

answers:

1

I would like to adjust the size of an element in the opposite direction, so the code below does adjust it, but it enlarges it from current position to bottom, I want current position to top. What would be an efficient way of doing this? thanks

var ele=document.getElementById('mydiv');
ele.style.height = 500+'px';
+1  A: 

Do what you're doing, then move the element up by its original height:

var ele=document.getElementById('mydiv');
ele.style.height = 500+'px';
ele.style.top -= 100+'px'; //or whatever the height originally was.
DannySmurf
I know its a given but you should include "position: absolute".
Luca Matteis
.... if that's specified in the element's style, it's redundant here.
DannySmurf