matthewp / position--sticky-

Polyfill for position: sticky;
175 stars 34 forks source link

Added debounced scroll handling #17

Closed stucox closed 10 years ago

stucox commented 10 years ago

Doing lots of work (especially DOM work/repaints) on every 'scroll' event can kill scroll performance, so debouncing the scroll handling alleviates this.

Where available, this patch uses requestAnimationFrame() to align paints with the browser’s frame scheduling; otherwise it just throttles to ~67 updates per second.

Based on the techniques described here.

matthewp commented 10 years ago

Awesome! Thanks so much.