meteor-ionic/components/ionView/ionView.js
Jamie Loberman 45dd4d61b8 Only scroll entering nav view, not the one you're leaving.
If you had already been to a page previously, and then navigated away from it, there was a flash of it's previous scroll position that showed.  This ensures that only the view that is being animated in to view, is scrolled to the correct position, and the one leaving the view is left alone.
2015-07-08 11:51:22 -07:00

28 lines
753 B
JavaScript

Template.ionView.rendered = function () {
// Reset our transition preference
IonNavigation.skipTransitions = false;
// Reset our scroll position
var routePath = Router.current().route.path(Router.current().params);
if(IonScrollPositions[routePath]) {
$('.overflow-scroll').not('.nav-view-leaving .overflow-scroll').scrollTop(IonScrollPositions[routePath]);
delete IonScrollPositions[routePath];
}
};
Template.ionView.helpers({
classes: function () {
var classes = ['view'];
if (this.class) {
classes.push(this.class);
}
return classes.join(' ');
},
title: function () {
if ( Template.instance().data && Template.instance().data.title ) {
return Template.instance().data.title;
}
}
});