Val
Val

Reputation: 17522

Javascript alternative height, width control

is there away to use a different positioning system for elements. where you don't change the width and height of the element instead you can change it using left,right, top, bottom

more or less like the flex controllers?

Upvotes: 3

Views: 548

Answers (1)

Marko
Marko

Reputation: 72222

Yes you can, I'm not 100% sure if it's fully supported in all browsers but you can use absolute positioning and specify ALL of the coordinates.

i.e.

.pos {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
}

Which should stretch across the whole window.

You can then modify, or animate each of the properties in jQuery..

i.e.

$(".pos").animate({
    bottom: "50%",
    right: "50%"
}, 2000);

Cheers,

Marko

Upvotes: 2

Related Questions