0

I'm working on a jquery mobile hybrid app. as I have a fixed skeleton of the app, all I do is loading the content of each page on the <div data-role="content"> of the index file preserving the header / footer / sidebar etc...

$("#pageContent").load ("pages/login-view.html", function () {
    $(this).enhanceWithin();
});

Everything's working just fine.

But what's blocking me right now, is managing the back action when clicking on a left arrow in the header.

Since I'm not reloading the whole page and I'm loading only the content on pages inside my main page, I have no Idea how to create or use the Backstack of loaded pages contents.

Do you hve any idea about how to do this ?

Thank you.

Idan Adar
  • 44,156
  • 13
  • 50
  • 89
  • http://stackoverflow.com/a/18213393/1771795 with some modifications of course. You need to listen to `navigate` and then do what you want to do on `pagecontainerbeforechange` or `pagecontainerbeforetransition`. – Omar Oct 17 '14 at 16:53
  • Thank you @Omar :) But using `$(window).` doesn't mean that the whole page changes ? because in my case only the content of a div does –  Oct 17 '14 at 17:06
  • it depends on the button, `data-rel="back"` and browser's back button will fire `navigate` event. – Omar Oct 17 '14 at 17:08
  • @Omar : hello omar, sorry for this delay. So in order to use `data-rel="back"` as it should be used, I need to change the whole page instead of changing only a block. so the browser can store the history pages on it's stack right ?? –  Oct 21 '14 at 14:06
  • `data-rel=back` acts like browser's back button. Yes, all navigating actions are stored in history stack. If you want to navigate between divs (hidden/visible) you don't need `data-rel=back`, you can show/hide them. – Omar Oct 21 '14 at 14:41

0 Answers0