Skip to content
This repository has been archived by the owner on Sep 10, 2023. It is now read-only.

Commit

Permalink
feat: 如果页面处于初始的状态,没有滚动过,则出发一次onScroll事件
Browse files Browse the repository at this point in the history
  • Loading branch information
axetroy committed Sep 4, 2017
1 parent 35c952a commit 5f112d3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app.ts
Expand Up @@ -76,6 +76,11 @@ export class App {
.onInit();
this.onScrollHandler.push(provider.onScroll.bind(provider));
this.onHoverHandler.push(provider.onHover.bind(provider));

// 如果页面处于初始的状态,没有滚动过,则出发一次onScroll事件
if (window.scrollY <= 0) {
this.onScroll();
}
}
});
addEventListener('scroll', this.onScroll.bind(this));
Expand Down

0 comments on commit 5f112d3

Please sign in to comment.