From 19832edd851091047ca48dfb854f7f5aadf0c268 Mon Sep 17 00:00:00 2001 From: Daniel Twigg Date: Sun, 22 Mar 2015 21:38:47 +0000 Subject: [PATCH] Add "requestAnimationFrame" to improve scrolling performance --- scripts/jquery.parallax-1.1.3.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/jquery.parallax-1.1.3.js b/scripts/jquery.parallax-1.1.3.js index f3569dc..a2c630f 100644 --- a/scripts/jquery.parallax-1.1.3.js +++ b/scripts/jquery.parallax-1.1.3.js @@ -63,7 +63,10 @@ http://www.gnu.org/licenses/gpl.html }); } - $window.bind('scroll', update).resize(update); + $window.bind('scroll', function() { + window.requestAnimationFrame(update); + }).resize(function() { window.requestAnimationFrame(update); }); + update(); }; })(jQuery);