Alternative Javascript Height, Width Control

You can use a different positioning system for elements. where you do not change the width and height of the element, instead you can change it using left, right, top, bottom

more or less like floppy disk controllers?

+3
source share
1 answer

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

i.e.

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

Which should stretch across the window.

Then you can change or change each of the properties in jQuery ..

i.e.

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

Greetings

Marco

+2
source

Source: https://habr.com/ru/post/1755210/


All Articles