beedesk / jQTouch

jQT + actively maintained + exclusive features (iPad layout, iscroll, tons of css enhancements, page events, param passing between pages, radio button, grid, mail, improved page history management etc.)
http://bit.ly/beedesk-jqt
MIT License
72 stars 13 forks source link

Back button does not work with newly inserted page #2

Open thomasyip opened 13 years ago

thomasyip commented 13 years ago

If a page is not loaded by jqtouch automatically, (see GET Ajax Load example on demos\main), this fork doesn't not recognize the page when "back" button is hit.

To workaround the problem, manually add the following line when the page is created:

(note: you will need to remove the workaround when the bug is fixed, or it will affects splitscreen usage).

var defaultSection ="full";  // for single screen
var section = $node.attr('section'); 
if (!section) {
  $node.attr('section', defaultSection);
}                
$node.children().find('[section~="' + section + '"]').removeClass('missection');
$node.children().find('[section]:not([section~="' + section + '"])').addClass('missection');                  
mckoss commented 13 years ago

Isn't the section variable undefined in some cases?

thomasyip commented 13 years ago

I think I was pondering on null or "full" as the default, and picked "full" randomly.

This bug probably prove that null as default is better for this case.

l0c0luke commented 13 years ago

Do I fall into this problem ...

First, many of my pages are drawn as you click. Click, create html, append to jqt, goTo. Second, I have chosen to roll my own backbutton so I could tweak the coloring a bit more. So to avoid conflicts, the back button container I call back2. I then create a live event on the back2 which executes jQT.goBack().

So what I am finding is that if I go one page in, and then go back, no problems. If I go two pages in, then go back, I go to the second page, but the first page also slides in underneath the second, creating a mess.

thomasyip commented 13 years ago

It might be a variety of it.

If you generate html, adding section="full" should fix it.

Also, you can use the ".goback" class for your own theme. With it, you don't need your own go back method.

    <a href="..." section="full" class="goback">
l0c0luke commented 13 years ago

goback class is what I needed. you da man. count me out of this backbutton ajax issue.