问题
As specified in the global config options I am trying to override jQuery Mobile default settings using the script order as specified in:
http://jquerymobile.com/test/docs/api/globalconfig.html
I am able to achieve this however when I navigate pages on an ios device(iphone4 running ios5) they seem to be duplicated and appear over the top of one another once you visit a few links, or click the back button a few times.
Here is my script order.
<script src="//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.4.min.js"></script>
<script>
// my custom script
$(document).bind("mobileinit", function(){
//apply overrides to default settings
$.mobile.touchOverflowEnabled = true;
$.mobile.loadingMessage = false;
$.mobile.defaultPageTransition = 'none';
});
</script>
<script src="//ajax.aspnetcdn.com/ajax/jquery.mobile/1.0/jquery.mobile-1.0.min.js"></script>
Here is the example (to see bug view on ios device):
http://dev.solidstategroup.com/ssgwebsite/mobile/
I'm not sure what I'm doing wrong and I have not come across this issue anywhere. Weirdly the problem can't be reproduced in ios simulator or in the browser.
I have taken all other scripts out to eliminate these.
If anyone can advise or think of a way to override the default settings in another way it may help others.
Many thanks.
回答1:
The resolution for this was to remove the touchOverflow feature below.
$.mobile.touchOverflowEnabled = true;
Removing this parameter means touchOverFlowEnabled is set to it's default value of false.
This feature is apparently known to be unstable and as it states in the docs:-
http://jquerymobile.com/test/docs/pages/touchoverflow.html
there are known downsides and the docs advise to use with caution (although this particular problem isn't listed).
来源:https://stackoverflow.com/questions/9038624/page-loaded-twice-when-trying-to-override-jquery-mobile-default-settings-with-to