mirror of
https://github.com/donl/meteor-ionic.git
synced 2026-05-26 22:06:41 -06:00
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.
28 lines
753 B
JavaScript
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;
|
|
}
|
|
}
|
|
});
|