[英]iPhone - Using jquery-mobile in a UIWebView
我以前從未使用過jquery,並且嘗試在UIWebView上使用它,盡管這很容易,但是顯然我必須缺少一些明顯的東西,所以我有點遵循了這種方式,因此JQuery Mobile在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
版。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.