1// convert px to %
2var pixels = 100; // px
3var screenWidth = window.screen.width; // total px across width
4var percentage = ( screenWidth - pixels ) / screenWidth ; // 0.92%
5
6// convert % to px
7var percentage = 5; // %
8var screenWidth = window.screen.width; // total px across width
9var pixels = Math.round(( percentage/100 ) * screenWidth) ; // 90px