jQuery Mobile changePage с пролистывающим переходом
Я могу'кажется, что "задний ход" эффект скольжения при работе с "swiperight» событие. Итак, приведенный ниже код работает нормально, но я хотел бы, чтобы я сделал "swiperight» что следующая страница будет скользить с левой стороны, а не с правой стороны. Я сделал поиск документации и добавилreverse: true
каккак это рекомендуется в "swiperight ":
$.mobile.changePage("#page"+nextPage, {transition : "slide", reverse:true});
но это не дает желаемого эффекта. Можете ли вы указать, где я делаю это неправильно?
У меня есть следующий код наjsFiddle:
HTML:
jQuery Mobile Application
jQuery Mobile
<p>First page!</p>
O'Reilly
jQuery Mobile
<p>Second page!</p>
O'Reilly
jQuery Mobile
<p>Third page!</p>
O'Reilly
JQuery:
(function($) {
var methods = {
init : function(options) {
var settings = {
callback: function() {}
};
if ( options ) {
$.extend( settings, options );
}
$(":jqmData(role='page')").each(function() {
$(this).bind("swiperight", function() {
var nextPage = parseInt($(this).attr("id").split("page")[1]) - 1;
if (nextPage === 0)
nextPage = 3;
$.mobile.changePage("#page"+nextPage, "slide");
});
$(this).bind("swipeleft", function() {
var nextPage = parseInt($(this).attr("id").split("page")[1]) +1;
if (nextPage === 4)
nextPage = 1;
$.mobile.changePage("#page"+nextPage, "slide");
});
})
}
}
$.fn.initApp = function(method) {
if ( methods[method] ) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
}
else if ( typeof method === 'object' || ! method ) {
return methods.init.apply( this, arguments );
}
else {
$.error( 'Method ' + method + ' does not exist' );
}
}
})(jQuery);
$(document).ready(function(){
$().initApp();
});