went vmousedown for all items instead of scrollable lists

This commit is contained in:
Tankred Hase 2013-03-14 21:21:16 +01:00
parent efa385c063
commit 6accc270f4
2 changed files with 18 additions and 17 deletions

View File

@ -11,7 +11,6 @@ var AppRouter = Backbone.Router.extend({
}, },
initialize: function () { initialize: function () {
this.firstPage = true;
}, },
login: function() { login: function() {
@ -28,10 +27,8 @@ var AppRouter = Backbone.Router.extend({
}, },
compose: function() { compose: function() {
// $.mobile.defaultPageTransition = 'slideup';
var composeView = new app.view.ComposeView(); var composeView = new app.view.ComposeView();
this.changePage(composeView); this.changePage(composeView);
// $.mobile.defaultPageTransition = 'slideup';
}, },
folders: function(userId) { folders: function(userId) {
@ -64,25 +61,19 @@ var AppRouter = Backbone.Router.extend({
$('body').append(pageEl); $('body').append(pageEl);
// handle back click // handle back click
var self = this;
pageEl.on('vmousedown', '#backBtn', function(e) { pageEl.on('vmousedown', '#backBtn', function(e) {
e.preventDefault(); e.preventDefault();
self.back = true;
window.history.back(); window.history.back();
}); });
// change to the page using jQM transitions // change page for link buttons on vmousedown instead of waiting on vmouseup
var transition = $.mobile.defaultPageTransition; pageEl.on('vmousedown', 'a[data-role="button"]', function(e) {
// We don't want to slide the first page e.preventDefault();
if (this.firstPage) { var href = $(e.currentTarget).attr('href');
transition = 'none'; window.location = href;
this.firstPage = false; });
}
$.mobile.changePage(pageEl, {changeHash:false, transition:transition, reverse:this.back});
// change transition direction back after back button was pushed $.mobile.changePage(pageEl, {changeHash:false, reverse:false});
this.back = false;
// $.mobile.defaultPageTransition = 'fade';
} }
}); });

View File

@ -7,7 +7,17 @@ app.view.FolderListView = Backbone.View.extend({
}, },
render:function (eventName) { render:function (eventName) {
$(this.el).html(this.template(this.options)); var page = $(this.el);
page.html(this.template(this.options));
// change page for folder links on vmousedown instead of waiting on vmouseup
page.on('vmousedown', 'li a', function(e) {
e.preventDefault();
var href = $(e.currentTarget).attr('href');
window.location = href;
});
return this; return this;
} }
}); });