Changed document.width to window.innerWidth

Not sure why I had it the way I did, but it used to work then it
didn’t. Should be working again.