Reputation:
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';
Upvotes: 1
Views: 373
Reputation: 15568
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.
Upvotes: 1