reywood:iron-router-scroll

v0.0.6Published 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="..."> or <div id="..."> 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('reywood:iron-router-scroll'); somewhere amongst your router code.

1if (Meteor.isClient) {
2    Router.plugin('reywood:iron-router-scroll');
3}
4
5Router.route('/', {
6    ...
7});

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