I'm using the code given in this answer to swipe several pages in my Phonegap application.
However, it seems that the live function is deprecated and furthermore, a "0" appears below the page when I try to reload. As I try more, a string of zeroes is created, the number of each telling the number of reloads of that page. Long story short: swiping works but a 0 appears in each load of the swiped page.
I tried to change to this but doesn't seem to work (I'm using Phonegap 2.1.0, jQuery 1.8.2 and jQuery Mobile 1.1.1).
<script type="text/javascript">
$('div.ui-page').on("swipeleft", function () {
var nextpage = $(this).next('div[data-role="page"]');
if (nextpage.length > 0) {
$.mobile.changePage(nextpage, {
transition: "slide",
reverse: false
}, true, true);
}
});
$('div.ui-page').on("swiperight", function () {
var prevpage = $(this).prev('div[data-role="page"]');
if (prevpage.length > 0) {
$.mobile.changePage(prevpage, {
transition: "slide",
reverse: true
}, true, true);
}
});
</script>
Edit: I tried with this and the same as the initial problem happens:
<script type="text/javascript">
$(document).delegate('div.ui-page', 'swipeleft', function () {
var nextpage = $(this).nexy('div[data-role="page"]');
if (nextpage.length > 0) {
$.mobile.changePage(nextpage, {
transition: "slide",
reverse: false
}, true, true);
}
});
$(document).delegate('div.ui-page', 'swiperight', function () {
var prevpage = $(this).prev('div[data-role="page"]');
if (prevpage.length > 0) {
$.mobile.changePage(prevpage, {
transition: "slide",
reverse: false
}, true, true);
}
});
</script>