mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
scroll listener using window.requestAnimationFrame
This commit is contained in:
parent
7d31f94c82
commit
ba19987cdb
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user