javascript - AngularJS: scroll inside div/ul and what not -


so, have directive:

app.directive("scroll", function ($window) {     return function(scope, element, attrs) {         angular.element($window).bind("scroll", function() {             if (this.pageyoffset > 50) {                 console.log(true);             } else {                 console.log(false);             }             scope.$apply();         });     }; }); 

it works fine when user scrolls browser window. need, directive work inside ul-element max-height: 300px.

so, function must respond, when user scrolls inside ul-element.

something works fine inside ul-element:

app.directive("scroll", function () {     return function(scope, element, attrs) {         angular.element(element).bind("scroll", function() {             console.log(true);             scope.$apply();         });     }; }); 

and have "true" in console, how can use pageyoffset here if works $window?

thanks lot.

the answer - use plain javascript.

it works:

app.directive("scroll", function () {     return function(scope, element, attrs) {         angular.element(element).bind("scroll", function() {             if(this.scrolltop > 50) {                 console.log("more 50");             } else {                 console.log("less 50");             }         });     }; }); 

Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -