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

target element is current page error on transition #25

Closed l0c0luke closed 12 years ago

l0c0luke commented 12 years ago

This is boggling me and I dont know where to start.

So when my page is loaded, i have only one thing underneath jqt div. When you click something that should navigate you to another page (i use a class called link which i can bind to), i run some logic to generate the page that we are going to, append it to the jqt div, then transition to the new page.

SO in my browser I get a weird slide transition effect where I see my new page slide in from the right all the way tothe left. cool. Then when it hits the end of the transition, it flashes and disappears and then reappears. I havent noticed this so much on the mobile device, just desktop.

And finally when I transition to a page i get these two errors...

target element is the current page on line 438 could not go back on 644

Another problem I am getting, likely related to my mess above, is that when i refresh my page, I get an error of

Uncaught TypeError: Cannot read property 'search' of undefined on jqtouch 660

I have to then refresh the page, and this goes away. I see this is in the back function which means i have some horible logic somewhere sine i ma loading the first page.

any help with illogical logic?

p.s. if you are wondering why i am doing it this way, its because I find that i can get the fastest response when viewing in a phonegap app on the device. no lag on click etc.

thomasyip commented 12 years ago

Is it possible that you trigger the transition twice.

Have you added e.preventDefault()

to your custom click handler? If you didn't, the default handler might attempt do another page transition.

On Wed, May 18, 2011 at 1:24 PM, l0c0luke reply@reply.github.com wrote:

This is boggling me and I dont know where to start.

So when my page is loaded, i have only one thing underneath jqt div. When you click something that should navigate you to another page (i use a class called link which i can bind to), i run some logic to generate the page that we are going to, append it to the jqt div, then transition to the new page.

SO in my browser I get a weird slide transition effect where I see my new page slide in from the right all the way tothe left. cool. Then when it hits the end of the transition, it flashes and disappears and then reappears. I havent noticed this so much on the mobile device, just desktop.

And finally when I transition to a page i get these two errors...

target element is the current page on line 438 could not go back on 644

Another problem I am getting, likely related to my mess above, is that when i refresh my page, I get an error of

Uncaught TypeError: Cannot read property 'search' of undefined on jqtouch 660

I have to then refresh the page, and this goes away. I see this is in the back function which means i have some horible logic somewhere sine i ma loading the first page.

any help with illogical logic?

p.s. if you are wondering why i am doing it this way, its because I find that i can get the fastest response when viewing in a phonegap app on the device. no lag on click etc.

Reply to this email directly or view it on GitHub: https://github.com/beedesk/jQTouch/issues/25

l0c0luke commented 12 years ago

You might remember an email i sent you regarding my hack to get the browser back button to work. well the bollacks me right up and was the cause for the mierda i have above. commenting out my hash checking code solved this problem.

in this case the e.preventDefault() did not change anything. but i might have added your latest nofasttouch class, as i think as i type.

var hash = location.hash; 

setInterval(function() {
    if (location.hash != hash) {        
        if (hash != '') {
            jQT.goBack();                       
            hash = location.hash;
        }
    }
}, 100);

teach me to be hackish

thomasyip commented 12 years ago

Yeah. It was the reason that the goBack code was removed.

I attempted to do history using html5's history management. But, it generated more problems that it solved and I since removed it. Don't have better solution at the moment.