Skip to content Skip to sidebar Skip to footer

Jquery Height Returning Px Not Vh

Soo, Im working on an html-editor and setting vh values to div's. But when I try to use $(id).height(); or $(id).css('height'); it is always returning px value and not the vh. This

Solution 1:

You will always get height or width in pixels. You will have to manually convert it to vh or vw value

Here is previous question: https://stackoverflow.com/a/28295133/1548301

1px = (100 / document.documentElement.clientWidth)vw e.g. — If your viewport was 500px wide (equals by definition to 100vw) then

1px = (100 / 500) = 0.2vw

Post a Comment for "Jquery Height Returning Px Not Vh"