Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 397
Val Avatar asked Sep 09 '26 22:09

Val


1 Answers

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

like image 50
Marko Avatar answered Sep 12 '26 10:09

Marko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!