我以前从未使用过 jquery,我正在尝试在 UIWebView 上使用它,虽然这很容易,但显然我一定遗漏了一些明显的东西,我有点遵循这个 SO JQuery Mobile not working inside UIWebView
我正在将一个动态 html 字符串加载到我的 UIWebView 中,并在开头附加了一些从本地 html 文件加载的样式(这工作正常),它是这样的:
<html>
<head>
<style>
//Some style...
</style>
<link rel="stylesheet" href="jquery.mobile-1.3.1.min.css"/> //Is this what i have to do to load it??
<script src="jquery.mobile-1.3.1.min.js"></script> //Is this what I have to do load it???
//Closing tags...
我还去了 jquerymobile.com 下载并获得了这 2 个文件:
jquery.mobile-1.3.1.min.css
jquery.mobile-1.3.1.min.js
我从编译源中删除并添加到复制包资源中,如上面的帖子中所建议的。
然后在正文中,我简单地添加了来自 http://jquerymobile.com/demos/1.3.0-rc.1/docs/content/content-collapsible.html 的示例代码
<div data-role="collapsible">
<h3>I'm a header</h3>
<p>I'm the collapsible content. By default I'm closed, but you can click the header to open me.</p>
</div>
据我了解,执行此操作后,我应该能够点击 div,它会展开和折叠。没错,它只是显示其中的所有文本,点击什么都不做。
任何关于我遗漏的帮助或分步指南都很棒。
谢谢
最佳答案
jQuery Mobile 需要 jQuery 才能正常工作。
另请注意,jQuery Mobile 已锁定到某些 jQuery 版本,因此如果您使用的是 jQuery Mobile 1.3.1.
,那么您至少需要使用 jQuery 1.8.3
但我建议您使用版本 1.9
。
关于jquery - iPhone - 在 UIWebView 中使用 jquery-mobile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16697464/