convert between rem and px
var style = window.getComputedStyle(document.documentElement, null).getPropertyValue('font-size'),
fontSize = parseInt(style),
calcUnit = function(fn, unit) {
return fn(unit);
},
px = function(rem) {
return rem * fontSize;
// rem -> px
},
rem = function(px) {
return px / fontSize;
// px -> rem
};