尝试使用touchOverflowEnabled覆盖jQuery Mobile默认设置时,页面加载了两次 [英] Page loaded twice when trying to override jQuery Mobile default settings with touchOverflowEnabled
问题描述
按照全局配置选项中的指定,我试图使用以下脚本中指定的脚本顺序覆盖jQuery Mobile的默认设置:
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
我能够实现这一点,但是当我在ios设备(运行ios5的iphone4)上浏览页面时,它们似乎是重复的,并且一旦您访问一些链接或单击返回按钮几下,它们就会彼此重叠显示.时间.
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.
这是我的脚本顺序.
<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>
以下是示例(查看ios设备上的错误视图):
Here is the example (to see bug view on ios device):
http://dev.solidstategroup.com/ssgwebsite/mobile/
我不确定自己做错了什么,也没有在任何地方遇到过此问题.奇怪的是,该问题无法在ios模拟器或浏览器中重现.
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.
非常感谢.
推荐答案
解决方案是删除下面的touchOverflow功能.
The resolution for this was to remove the touchOverflow feature below.
$.mobile.touchOverflowEnabled = true;
删除此参数意味着touchOverFlowEnabled设置为默认值false.
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).
这篇关于尝试使用touchOverflowEnabled覆盖jQuery Mobile默认设置时,页面加载了两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!