尽管有很多人提到类似的兼容性问题,但 50% 的问题在 StackOverflow 上得到了解决。我希望我的问题能够成为 51-49 :)
考虑这段代码:
<html>
<head>
<title>Hello, world!</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
</head>
<body>
Hello
</body>
</html>
如果您将其加载到网页上,您将在浏览器中间看到一个灰色圆圈,并且不会显示“Hello”一词。在 Web 控制台上,您将看到以下内容:未捕获的类型错误:对象 0 没有方法“匹配”(铬)或类型错误:c.match 不是函数(火狐)或SCRIPT438:对象不支持属性或方法“匹配” (IE).
想在页面上同时使用 jquery-ui 和 jquery-mobile 是一个坏主意,还是我做错了什么?
唯一相关的是一个顺序,在 jUI 之后加载 jQM,CSS 文件也是如此:
<!DOCTYPE html>
<html>
<head>
<title>jQM Complex Demo</title>
<meta name="viewport" content="width=device-width"/>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
<body>
<div data-role="page" id="index">
Hello
</div>
</body>
</html>
您还需要:
<!DOCTYPE html>
这将阻止 ajax 加载器舞会显示:
<div data-role="page" id="index">
Hello
</div>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)