Soo, Im working on an html-editor and setting vh values to div's. But when I try to use
$(id).css("height"); it is always returning px value and not the vh. This should not be a problem, but I was planing on making is to a user could choose if he wished to use px or vh.
So is it another way to get jquery(or js) to tell me what type of height value that is set?
My question is not about converting data from px to %, but if it is possible to figure out what type of messurement the height is set as in css. In this case if it was defined as px or vh
You will always get height or width in pixels. You will have to manually convert it to
Here is previous question: <a href="https://stackoverflow.com/a/28295133/1548301" rel="nofollow">https://stackoverflow.com/a/28295133/1548301</a><blockquote>
1px = (100 / document.documentElement.clientWidth)vw<br /> e.g. — If your viewport was 500px wide (equals by definition to 100vw) then
1px = (100 / 500) = 0.2vw</blockquote>