Skip to content

Commit ba19987

Browse files
committed
scroll listener using window.requestAnimationFrame
1 parent 7d31f94 commit ba19987

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

js/ditto.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,10 @@ function router() {
286286
var sHeight = h - wh;
287287

288288
$w.on('scroll', function() {
289+
window.requestAnimationFrame(function(){
289290
var perc = Math.max(0, Math.min(1, $w.scrollTop() / sHeight));
290291
updateProgress(perc);
292+
});
291293
});
292294

293295
function updateProgress(perc) {

0 commit comments

Comments
 (0)