javascript convert px to vw

Solutions on MaxInterview for javascript convert px to vw by the best coders in the world

showing results for - "javascript convert px to vw"
Charles
18 Jul 2017
1//1px = 100vw / viewport's width (in px)
2
3function convertPXToVW(px) {
4	return px * (100 / document.documentElement.clientWidth);
5}