From ba19987cdb2f6b5ef606dd0ca3b49de6872484c6 Mon Sep 17 00:00:00 2001 From: ruanyf Date: Wed, 14 Oct 2015 18:51:59 +0800 Subject: [PATCH] scroll listener using window.requestAnimationFrame --- js/ditto.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/ditto.js b/js/ditto.js index d2d96cc..fa4a620 100644 --- a/js/ditto.js +++ b/js/ditto.js @@ -286,8 +286,10 @@ function router() { var sHeight = h - wh; $w.on('scroll', function() { + window.requestAnimationFrame(function(){ var perc = Math.max(0, Math.min(1, $w.scrollTop() / sHeight)); updateProgress(perc); + }); }); function updateProgress(perc) {