cordova - Going back to previous page works in simulator not on iOS device jquerymobile -
i changing page method
$.mobile.changepage("preview.html", { transition : "slide", role : "page", changehash:true });
this how preview page looks like
<div data-role="page" data-name="preview" class="prew"> <div data-role="content"> //content </div> </div>
now when touch screen have go previous page.
so created function
$('.prew').live('tap', function() { alert('clicked'); history.go(-1);//<--this works in simulator not in device. //window.history.back() ;//<--this works in simulator not on device. //navigator.app.backhistory();<--this works fine on android not on ios. });
edit: have used plugin called photoswipe causes issue . history.go(-1),history.back() or data-rel="back" works fine on other pages.
photoswipe preventing getting previous page.
here method use. however, pages should have unique id in order have working.
$('.prew').on('tap', function() { // id of previous page var previous = '#' + $.mobile.activepage.prev('div[data-role="page"]')[0].id; // move previous page reverse effect $.mobile.changepage(previous, { transition: 'slide', reverse: true }); });
Comments
Post a Comment