美文网首页
JQuery mobile

JQuery mobile

作者: 影子ing | 来源:发表于2016-08-17 04:02 被阅读0次

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 无过渡效果。

相关文章

网友评论

      本文标题:JQuery mobile

      本文链接:https://www.haomeiwen.com/subject/ngfmsttx.html