rewriting to cope with ftdomdelegate's inability to listen to window.scroll