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

Improve $scroll and jemAnchorDirective #41

Open
jeme opened this issue Jul 29, 2013 · 1 comment
Open

Improve $scroll and jemAnchorDirective #41

jeme opened this issue Jul 29, 2013 · 1 comment
Milestone

Comments

@jeme
Copy link
Contributor

jeme commented Jul 29, 2013

#15 gave an initial implementation for scrolling that relies on an directive on element so scroll to that element.

This is due to the fact that it will be hard to determine when elements are loaded from a "state" perspective and even from a "view" perspective. Therefore it was necessary to provide scrolling at the right time (after DOM loading/rendering).

However, right now we could have duplicated anchors etc. causing for some unpredictable behavior (fairly sure it will go to the last element)

Instead we should just register these elements with the $scroll service so we can detect duplicates etc.

@jeme
Copy link
Contributor Author

jeme commented Jul 30, 2013

Example usages desired on state:

  • scrollTo:top - scroll to top, explicitly stated. (This also enables one to override another scrollTo from a parent)
  • scrollTo:null - don't scroll, not even to top.
  • scrollTo:@viewname - scroll to a view.
  • scrollTo:elementid - scroll to an element id
  • scrollTo:['$stateParams', function($stateParams) { return stateParams.section; }] - function providing either of the above

Example usages of $scroll:

  • $scroll('element-id') - scroll to an element id
  • $scroll(200) - scroll the viewport 200px down
  • $scroll('@viewname') - scroll to a view
  • $scroll('top') - scroll to the top
  • $scroll() - scroll to the top

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant