-
Notifications
You must be signed in to change notification settings - Fork 21
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
Add Service for programmatic use #13
Comments
Awesome, thanks for sharing your contribution. Do you think you could make a PR from it, to add your service in the module ? |
:) yes, I think I can do that in the next days. |
Awesome, happy to review it! What is your exact use-case to use this feature directly in a controller ? |
I use it for a smoth "scroll back to top" (scroll to position 0 not to an element) button and my app scrolls automatically to the element when the corresponding hash of the element-id is setted in the url. In addition, I scroll smoothly back to the element when the page size changes because this can also change the the position of the elements. |
I've created a video that shows for what I need it exactly: https://drive.google.com/file/d/0B5r20MKWjT9YN1JXVE1sWDByY0E |
I've create a Service of your directive in my project to use the scroll functionality in my Controllers.
My changes:
Source: https://github.com/JumpLink/cms/blob/0f95a035bc7bed117393b1685b1fdab3f2aee35d/src/assets/general/js/angular/services.js#L721
If you want to use the autoPosition function you need to inject an empty $anchorScroll that does nothing, so you can use angularSmoothscroll for thinks like that.
Source: https://github.com/JumpLink/cms/blob/0f95a035bc7bed117393b1685b1fdab3f2aee35d/src/assets/general/js/angular/config.js#L29
Example for autoPosition:
Source: https://github.com/JumpLink/cms/blob/0f95a035bc7bed117393b1685b1fdab3f2aee35d/src/assets/general/js/angular/controllers.js#L100
Do you interested to merge my changes? I would need to rewrite this stuff in CoffeeScript (I have no experience with CoffeeScript yet) and would make it compatible with your directive.
The text was updated successfully, but these errors were encountered: