Right now my DOM has three divs with data-roll="page"
, all of them have unique id's. If I use the following code it works but jQuery Mobile is creating a new node rather than switching to the already existing node.
$('div.ui-page').live("swipeleft", function(){
var nextpage = $(this).next('div[data-role="page"]');
// swipe using id of next page if exists
if (nextpage.length > 0) {
console.log(nextpage);
$.mobile.changePage(nextpage.attr('id'), {transition: 'slide'});
}
});
I have also tried passing just nextpage to the .chagePage
method but when ever the pages have an id set I get the following error.
TypeError: b.split is not a function
So I'm looking to switch directly to the already existing "page" thats in the DOM rather than create a new one from my swipeleft handler.
I'm using jQuery 1.7.1 and jQuery Mobile 1.1.1