简体   繁体   English

如何在angularjs中检测水平滚动事件?

[英]how to detect horizontal scroll event in angularjs?

I have two areas in my html. 我的html中有两个区域。 All two areas can only horizontal scroll. 所有两个区域只能水平滚动。 What I want to realize is, if I horizontal scroll one area, another area can get the same horizontal scroll offset. 我要实现的是,如果我水平滚动一个区域,则另一个区域可以获得相同的水平滚动偏移。 How to realize that in angularjs? 如何在angularjs中实现呢? I try to use 我尝试使用

angular.element(document.getElementById('xxx')).bind('scroll', function() {
   ...
})

But it does no use. 但这没有用。 Anyone can tell me how? 有人可以告诉我如何吗?

You could try this angular module. 您可以尝试此角度模块。 ng-scrollable ng可滚动

It contains the spyX and spyY property where you can control the positions of the scrollbar. 它包含spyX和spyY属性,您可以在其中控制滚动条的位置。 You could get the scrollbar position on the first html scrollable and bind it to the second one. 您可以在第一个html滚动条上获得滚动条位置,并将其绑定到第二个html滚动条。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM