pra*_*ram 15 javascript angularjs angularjs-directive
我想在AngularJS指令中实现类似的东西:
https://github.com/geniuscarrier/scrollToTop/blob/master/jquery.scrollToTop.js
这是相当简单的,当你不在页面的顶部时,它将淡入按钮滚动到顶部:
$(window).scroll(function() {
if ($(this).scrollTop() > 100) {
$this.fadeIn();
} else {
$this.fadeOut();
}
});
Run Code Online (Sandbox Code Playgroud)
但是我很难找到如何在Angular中获取当前滚动位置.我宁愿不必仅仅为这件事使用jQuery.
谢谢!
| 归档时间: |
|
| 查看次数: |
51674 次 |
| 最近记录: |