Switched to binding events on the document instead of the window to fix issue with scroll sometimes not being cancelled.