Open jamminjames opened 9 years ago
Disable history api via history:false
option, or implement your own by forking it that will fit your needs https://github.com/dimsemenov/PhotoSwipe/blob/master/src/js/history.js
When I disable the history api, and test on a desktop, the back button will go back to index, but not the 'x' button, which still shows a blank page. Testing the same on an android device, clicking 'x' gets a blank page, and the back button closes the app completely.
On the index page, the link to the gallery has a jquery.mobile data-ajax="false" setting on it, as the gallery does not work properly without that. I don't know if that is affecting this behavior or not.
If you could take a look at it here, maybe you could tell me what I'm doing wrong: http://www.humortimes.com/wp-content/mu-plugins/humortimes/index.html (the gallery is the first button, "The News in Cartoons").
Thank you very much.
I think the issue is that the way it's designed, hitting the 'x' button in the slider takes the user back to the gallery. But I have it set up so that there is no gallery page -- when you click on the button in index.html, it goes straight to the slider. So, I don't understand how to reconfigure photoswipe to go back to the index.html page of the app when you exit using the 'x' button.
Ended up just adding a listener for the close function and using pushState to direct it to index.html of the app, like so:
gallery.listen('close', function() { window.history.pushState('main', null, 'index.html' ); location.reload(); });
... right before gallery.init();
This works, but is there a better way?
Ugh... this isn't working after all. Worked in the browser but not in the app. Also tried:
gallery.listen('close', function() { pswp.close(); return; });
Also works in browser but not app. Any help would be most appreciated. Thank you.
Okay, a combination of the above two seems to work:
gallery.listen('close', function() { window.history.pushState('main', null, 'index.html' ); location.reload(); pswp.close(); return; });
I'm building a jquery mobile app via Phonegap Build, and when I tap the 'X' in the top bar to close the gallery, I get a blank page. How can I make it go back to the app's index page?