S
S
Spegulo2010-10-28 09:47:37
JavaScript
Spegulo, 2010-10-28 09:47:37

"Rubberness" js elements?

Is there a way to detect that the size of some page element is given in %? in the DOM, as I understand it, already calculated values ​​\u200b\u200bare stored, which are automatically recalculated during resize.

You can put the question differently: is it possible in any way to change such automatically calculated dimensions without losing the “rubberness”?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
MyraJKee, 2010-10-28
@MyraJKee

Why does a rubber element need to be dimensioned?
It will be rubber as long as its dimensions are defined as a percentage. Therefore, in order for the element to remain rubber, the dimensions must be set in%.

W
web4_0, 2010-10-28
@web4_0

document.getElementById("element").style.width

G
Gregory, 2010-10-28
@Old_Chroft

If I understand correctly, then:
we find the width of the browser window (WBx) in pixels, we take the value as 100%. Wpx/100=value_of_percentage_in_pixels (VP). Find the width of the desired element in pixels (WHE).
SH/VP=percentage_of_element_width_to_window_width.
Recently I did this - I don’t have ready-made code at hand, but I’ll say that it’s done on JQuery once or twice.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question