Fix scrolling

(Written in a way that doesn't change behaviour on older browsers, hopefully.)