Search code examples
javascriptjqueryjqtouch

JQTouch - Navigate forward without adding page to history


How can you navigate to a page without adding it to JQTouches internal history stack?

I have something like:

<div id="section1"></div>
<div id="section2"></div>
<div id="section3"></div>

and using javascript I navigate from #section1 to #section2 using:

jQT.goTo($('#section2'), 'slide'); //with history tracking

and then to #section3:

jQT.goTo($('#section3'), 'slide'); //want this to be without history tracking

So if I had a back button on #section3 and clicked it, it would take me back to #section1 because #section2 would not have been added to the history stack.


Solution

  • I see two possible solutions to this. One is, if you know which page you want to go back to, you could simply use the public function like:

    jQT.goBack('#section1');
    

    You can read more about jQT's public objects here.

    If you want more control over the history, you might consider tweaking the jQT library so you can access the internal history object. I had to do this to look at the previous page in history.