say
say

Reputation: 2655

jQuery Mobile Page Transition Problems

After clicking back and forth between two separate pages (done via ajax) the pages begin to jump back the to other without my input. For example, if I have pg 1 and pg 2. I'll click back and forth between 1 and 2 a few times and then at some point when I click 2, it will load then immediately go back to 1. fyi..removing the ajax loading fixes the problem.

I am using the following libraries on my page:
- PhoneGap
- jQuery Mobile
- iScroll
- Modernizr

Any idea on what's happening here?

Upvotes: 0

Views: 774

Answers (1)

Héctor
Héctor

Reputation: 11

it seems a problem I had some time ago with jqm. When you have loaded and reloaded many pages it seems that the actions you take are executing more than once. I solved it unbinding (undelegating...) instructions like this:

$('div').bind('click', function(){ ... });

for:

$('div').unbind('click').bind('click', function(){ ... });

Proceeding this way the handler will only call the function once, because the unbind call tells ajax to release it.

Anyways, I'm pretty sure it's not the best behaviour, so I think it should be some better way to solve this issues, but I don't know it ;)

Upvotes: 1

Related Questions