JQuery mobile

JQuery mobile

jQuery Mobile 是創建移動 web 應用程序的框架
jQuery Mobile 適用于所有流行的智能手機和平板電腦

編寫頁面的參數:

data-role="navbar" 屬性來定義導航欄
data-role="page" 是顯示在瀏覽器中的頁面
data-role="header" 創建頁面上方的工具欄(常用于標題和搜索按鈕)
data-role="content" 定義頁面的內容,比如文本、圖像、表單和按鈕,等等
data-role="footer" 創建頁面底部的工具欄

所有的按鈕

對于多個頁面,也許需要為每個按鈕設置“被選”外觀,以表示用戶正在瀏覽該頁面。
則添加 "ui-state-persist" 類,以及 "ui-btn-active" 類
<li><a href="#anylink" class="ui-btn-active ui-state-persist">官網</a></li>

普通按鈕

data-role="button"
<a href="#" data-role="button">按鈕</a>
<a href="#pagetwo" data-role="button">轉到頁面二</a>

行內按鈕

如果需要按鈕適應其內容,或者如果需要兩個或多個按鈕并排顯示,請添加 data-inline="true"
<a href="#pagetwo" data-role="button" data-inline="true">轉到頁面二</a>

組合按鈕:

<div data-role="controlgroup" data-type="horizontal">
    <a href="#anylink" data-role="button">按鈕 1</a>
    <a href="#anylink" data-role="button">按鈕 2</a>
    <a href="#anylink" data-role="button">按鈕 3</a>
</div>

后退按鈕

<a href="#" data-role="button" data-rel="back">返回</a>

更多用于按鈕的 data-* 屬性

data-* 的值都是 true/false
data-corners 規定按鈕是否有圓角
data-mini 規定是否是小型按鈕
data-shadow 規定按鈕是否有陰影

普通表單:

<form method="post" action="demoform.asp">
   <div data-role="fieldcontain">
     <label for="fullname">全名:</label>
     <input type="text" name="fullname" id="fullname">         
     <label for="bday">生日:</label>
     <input type="date" name="bday" id="bday">
     <label for="email">電郵:</label>
     <input type="email" name="email" id="email" placeholder="您的郵件地址..">
   </div>
</form>

單選框或復選框進行水平分組,使用 data-type="horizontal"屬性單選按鈕:

<form method="post" action="demoform.asp"> 
    <fieldset data-role="controlgroup" data-type="horizontal">     
      <legend>Choose your gender:</legend> 
      <label for="male">Male</label>
      <input type="radio" name="gender" id="male" value="male"> 
      <label for="female">Female</label> 
      <input type="radio" name="gender" id="female" alue="female"> 
    </fieldset>
</form>

多選按鈕:

 <form method="post" action="demoform.asp">
   <fieldset data-role="controlgroup">
     <legend>Choose as many favorite colors as you'd like: </legend>
     <label for="red">red</label>
     <input type="checkbox" name="favcolor" id="red" value="red">
     <label for="green">green</label>
     <input type="checkbox" name="favcolor" id="green" value="green"> 
     <label for="blue">blue</label>
     <input type="checkbox" name="favcolor" id="blue" value="blue">
  </fieldset>
</form>

頁面滑動的效果:

<a href="#anylink" data-transition="slide">滑動到頁面二</a>

data-transition 屬性一同使用的可用參數:

>fade 默認。淡入淡出到下一頁。

flip 從后向前翻動到下一頁。
flow 拋出當前頁面,引入下一頁。
pop 像彈出窗口那樣轉到下一頁。
slide 從右向左滑動到下一頁。
slidefade 從右向左滑動并淡入到下一頁。
slideup 從下到上滑動到下一頁。
slidedown 從上到下滑動到下一頁。
turn 轉向下一頁。
none 無過渡效果。

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容