Skip to content

Instantly share code, notes, and snippets.

@winwu
Last active December 15, 2015 08:46
meteor scrolltop when page onload
/* Source from https://github.com/tmeasday/meteor-router/issues/71#issuecomment-51592305 START */
Router._filters = {
resetScroll: function () {
var scrollTo = window.currentScroll || 0;
$('body').scrollTop(scrollTo);
$('body').css("min-height", 0);
}
};
var filters = Router._filters;
if(Meteor.isClient) {
Router.onAfterAction(filters.resetScroll); // for all pages
}
/* Source from https://github.com/tmeasday/meteor-router/issues/71#issuecomment-51592305 END */
// if you got 404...
Router.configure({
layoutTemplate: 'loginLayout',
notFoundTemplate: '404'
});
// your customer router~
Router.route('/', function () {
this.layout('loginLayout');
this.render("login");
});
Router.route('/login', function () {
this.layout('loginLayout');
this.render("login");
});
Router.route('/dashboard', function () {
this.layout('mainLayout');
this.render("dashBoard");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment