implement tap statusbar to scroll to top (fixes #8), misc transition fixes

This commit is contained in:
Nick Wientge 2015-02-01 18:43:40 -08:00
parent 5b517363bc
commit 4799e2ef89
3 changed files with 20 additions and 7 deletions

View file

@ -39,7 +39,19 @@ Template.ionBody.helpers({
}
});
Template.ionBody.rendered = function () {
window.addEventListener('statusTap', function() {
$('.content.overflow-scroll').animate({
scrollTop: 0
}, 500);
});
};
Template.ionBody.events({
'statusTap': function () {
console.log('ionBody.statusTap');
},
'click [data-ion-modal]': function (event, template) {
var templateName = $(event.currentTarget).data('ion-modal');
IonModal.open(templateName, $(event.currentTarget).data());
@ -90,4 +102,4 @@ Template.ionBody.events({
'mouseup .button, touchend .button': function (event, template) {
$(event.target).removeClass('active');
}
});
});

View file

@ -57,7 +57,7 @@ Template.ionItem.helpers({
hash.hash = this.hash;
hash.data = this.data;
var options = new Spacebars.kw(hash);
// Devs may pass 'route=x' instead of 'path=' or 'url='
// Should doing that throw an error? Not sure but we decided to
// parse it as if the dev passed it as 'path='

View file

@ -20,7 +20,7 @@ Template.ionNavView.created = function () {
if (this.transition === 'ios') {
this.transitionDuration = 450;
} else {
this.transitionDuration = 200;
this.transitionDuration = 320;
}
};
@ -38,17 +38,18 @@ Template.ionNavView.rendered = function () {
$node.insertBefore(next).addClass('nav-view-entering nav-view-stage');
Meteor.setTimeout(function() {
$node.removeClass('nav-view-stage').addClass('nav-view-active');
}, 16);
}, 0);
Meteor.setTimeout(function () {
$(this).removeClass('nav-view-entering');
$('[data-nav-container]').removeClass('nav-view-direction-back').addClass('nav-view-direction-forward');
}, template.transitionDuration + 16);
}, template.transitionDuration);
},
removeElement: function(node) {
var $node = $(node);
if (!template.transition || !$node.hasClass('view') || IonNavigation.skipTransitions) {
console.log('removing node w/o animating…');
$node.remove();
return;
}
@ -56,12 +57,12 @@ Template.ionNavView.rendered = function () {
$node.addClass('nav-view-leaving nav-view-stage');
Meteor.setTimeout(function() {
$node.removeClass('nav-view-stage').addClass('nav-view-active');
}, 16);
}, 0);
Meteor.setTimeout(function () {
$node.remove();
Session.set('ionNavDirection', 'forward');
}, template.transitionDuration + 16);
}, template.transitionDuration);
}
};
};