Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/428.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度指令中未触发绑定滚动事件_Javascript_Angularjs_Scroll_Angularjs Directive - Fatal编程技术网

Javascript 角度指令中未触发绑定滚动事件

Javascript 角度指令中未触发绑定滚动事件,javascript,angularjs,scroll,angularjs-directive,Javascript,Angularjs,Scroll,Angularjs Directive,你好,我在angularjs1工作。我为我的应用程序创建了指令,现在我需要在该指令中绑定滚动事件。在该指令中,bindWHEEL事件在桌面上正确触发,但在移动设备或平板电脑上不起作用,因此我使用scroll绑定。但它甚至不能在桌面上工作 车轮 link: function (scope, element, attrs) { element.bind('wheel', function (e) { console.log("scrolling..."); //its work in De

你好,我在angularjs1工作。我为我的应用程序创建了指令,现在我需要在该指令中绑定滚动事件。在该指令中,bindWHEEL事件在桌面上正确触发,但在移动设备或平板电脑上不起作用,因此我使用scroll绑定。但它甚至不能在桌面上工作
车轮

 link: function (scope, element, attrs) {
element.bind('wheel', function (e) {
    console.log("scrolling..."); //its work in Desktop
});
})   
link: function (scope, element, attrs) {
element.bind('scroll', function (e) {
    console.log("scrolling..."); //its not work 
});
}) 
滚动

 link: function (scope, element, attrs) {
element.bind('wheel', function (e) {
    console.log("scrolling..."); //its work in Desktop
});
})   
link: function (scope, element, attrs) {
element.bind('scroll', function (e) {
    console.log("scrolling..."); //its not work 
});
}) 
我如何处理它,然后ng-单击滚动顶部也不工作。如果有我需要初始化的东西
对于滚动事件

您是否尝试过移动设备的触摸移动事件

 element.bind('touchmove', function (e)
 {
        console.log("scrolling...");
 });

移动设备使用的事件与普通浏览器不同。检查链接以获取更多信息。顺便说一句,如果解决方案有效,请标记它。t通过使用touchmove,我如何检测水是向上还是向下移动。因为我需要在向下滚动时隐藏div,在向上滚动时显示div。很抱歉,这不是问题的一部分,您应该在做一些研究后打开一个新问题。我认为回答这个问题有点违反了SO的规定