简体   繁体   中英

Bind scroll event is not trigger in angular directive

Hello I'm working in angularjs1. I created directive for my app now I need to bind scroll event in that directive. In that directive bind WHEEL event correctly trigger in Desktop but its not worked in mobile or tablet, so I go with scroll bind. But it doesn't work even Desktop
wheel

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

scroll

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

How can I handle it, and then ng - click scroll top also not working.if there I need to initialize something for scroll event

Have you tried touchmove event for mobile devices?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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