mirror of
https://github.com/donl/meteor-ionic.git
synced 2026-06-30 06:12:08 -06:00
reset scroll position when navigating back. fixes #1
This commit is contained in:
parent
68b8ebca6c
commit
5ad12ffa58
3 changed files with 14 additions and 1 deletions
|
|
@ -1,3 +1,9 @@
|
|||
IonScrollPositions = {};
|
||||
|
||||
Router.onStop(function () {
|
||||
IonScrollPositions[Router.current().route.getName()] = $('.overflow-scroll').scrollTop();
|
||||
});
|
||||
|
||||
Template.ionNavBackButton.events({
|
||||
'click': function (event, template) {
|
||||
$('[data-nav-container]').addClass('nav-view-direction-back');
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
Template.ionView.rendered = function () {
|
||||
// Reset our transition preference
|
||||
IonNavigation.skipTransitions = false;
|
||||
|
||||
// Reset our scroll position
|
||||
var routeName = Router.current().route.getName();
|
||||
if(IonScrollPositions[routeName]) {
|
||||
$('.overflow-scroll').scrollTop(IonScrollPositions[routeName]);
|
||||
delete IonScrollPositions[routeName];
|
||||
}
|
||||
};
|
||||
|
||||
Template.ionView.helpers({
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ Package.describe({
|
|||
|
||||
Package.onUse(function(api) {
|
||||
api.versionsFrom("1.0");
|
||||
api.use(["templating", "underscore", "fastclick"], "client");
|
||||
api.use(["templating", "underscore", "fastclick", "iron:router"], "client");
|
||||
|
||||
api.addFiles([
|
||||
"vendor/snap.js",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue