Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 649 Bytes

README.md

File metadata and controls

29 lines (21 loc) · 649 Bytes

JankFreeScroll

JankFreeScroll uses Request Animation Frame in order to help you run javascript on a page while a user is scrolling. This method avoids using a scroll event handler and as a result, is better for performance.

431 bytes Minified + Gzipped

How to Use

<script src="jankfreescroll.js"></script>
var s = jankfreescroll({
	onScrollDown() {
		console.log('down');
	},
	onScrollUp() {
		console.log('up');
	}
});

//to cancel

window.cancelAnimationFrame(s.frameID);

Try it out

http://codepen.io/tevko/pen/dXzNrw