Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use $watch to monitor the top of the element which generates by ng-scrollbar #53

Open
knonginda opened this issue Dec 21, 2016 · 0 comments

Comments

@knonginda
Copy link

knonginda commented Dec 21, 2016

Hi, I am a newbie for Angular, in this case, I use window scroll event to monitor the scrollTop to change the class name, but after using ng-scrollbar, I found I couldn't do it in that way because ng-scrollbar is used to change the top of style to scroll the viewport.

The following example shows my old codes, then how to use $watch to monitor the top of the element which is generated by ng-scrollbar:

          angular.element(window).bind("scroll", function() {
                if (this.pageYOffset >= 54) {
                    $scope.isVisible = false;
                } else {
                    $scope.isVisible = true;
                }
                $scope.$apply();
            });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant