reywood:iron-router-scroll

v0.0.3Published 9 years ago

This package has not had recent updates. Please investigate it's current state before committing to using it in your project.

iron-router-scroll

Sane default scroll behavior when navigating from page to page with iron:router.

Does it seem odd that when you've scrolled a ways down a page and then clicked a link, the new page doesn't automatically start with the scroll position at the top? This package should fix that. It also has a bit of support for:

  • Scrolling to the user's position on the previous page when they hit the browser's "Back" button
  • Scrolling to the appropriate <a name="..."> when there is a hash (#) in the URL

Installing & Using

To install:

$ meteor add reywood:iron-router-scroll

To enable the plugin, you will need to call Router.plugin('pageScroll'); somewhere amongst your router code.

1Router.configure({
2    ...
3});
4
5Router.plugin('pageScroll');
6
7Router.route('/', {
8    ...
9});

If you find a bug or would like to see an improvement made, please file an issue or submit a pull request on GitHub.