Is it possible to get the width of the window in em units using javascript?
Here's a solution that doesn't require jQuery, and doesn't require an explicit font-size declaration.
window.innerWidth / parseFloat(
getComputedStyle(
document.querySelector('body')
)['font-size']
)
This seems to work:
$(window).width() / parseFloat($("body").css("font-size"));