jQuery Mobile,jquerymobile
引用 jQuery Mobile,可以
jQuery Mobile CDN:
<head><link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"><script src="http://code.jquery.com/jquery-1.8.3.min.js"></script><script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script></head>
也可以下載下來
<head><link rel=stylesheet href=jquery.mobile-1.3.2.css><script src=jquery.js></script><script src=jquery.mobile-1.3.2.js></script></head>
實現一個最簡單的頁面
<!DOCTYPE html><html><head><link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css"><script src="http://code.jquery.com/jquery-1.8.3.min.js"></script><script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script></head><body><div data-role="page"> <div data-role="header"> <h1>標題</h1> </div> <div data-role="content"> <p>內容</p> </div> <div data-role="footer"> <h1>頁尾</h1> </div></div></body></html>
HTML5 data-* 屬性用於通過 jQuery Mobile 為行動裝置建立“對觸控友好的”互動外觀。
在 jQuery Mobile,您可以在單一 HTML 檔案中建立多個頁面。
請通過唯一的 id 來分隔每張頁面,並使用 href 屬性來串連彼此:
每個都是一個page
<div data-role="page" id="pageone"> <div data-role="content"> <a href="#pagetwo">轉到頁面二</a> </div></div><div data-role="page" id="pagetwo"> <div data-role="content"> <a href="#pageone">轉到頁面一</a> </div></div>
在 jQuery Mobile 中建立按鈕
jQuery Mobile 中的按鈕可通過三種方法建立:
使用 元素
使用 元素
使用 data-role=”button” 的 元素
在頁尾設定了浮動後,若是設定了按鈕的類,就沒有效果了。
頭部若是設定成浮動和全屏,那麼點擊空白處能夠隱藏標題
<div data-role="header" data-position="fixed" data-fullscreen="true">