一、首先在<head></head>里面引入jQuery库、jQuery mobile库以及jQuery mobile样式

<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.5.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>

二、创建一个(左/右侧)面板

<body>
<div data-role="page" id="page" style="max-height:440px; min-height:440px;">
<div data-role="header"> </div>
<div data-role="content">
<a href="#defaultpanel" data-role="button" data-inline="true" data-icon="bars"> 打开面板</a>
</div>
<div data-role="panel" id="defaultpanel" data-theme="b">
<div class="panel-content">
<h3> 面板</h3>
<p> 这里是内容区域</p>
<a href="#demo-links" data-rel="close" data-role="button" data-theme="c" data-icon="delete" data-inline="true"> 关闭面板 </a>
</div>
</div>
</div>
</body>

加上CSS样式:

    <style>
html,
body {
padding:;
margin:;
} html,
.ui-mobile,
.ui-mobile body {
height: 435px;
} .ui-mobile,
.ui-mobile .ui-page {
min-height: 435px;
} .ui-content {
padding: 10px 15px 0px 15px;
} .panel-content {
padding: 15px;
height: 500px;
} #header a {
margin-top: 3px;
}
</style>

这时候点开是这个样子的:

然后我们打开调试,进入到响应式布局(我这里选用的iPhone6s屏幕尺寸):

这里说明已经创建好一个面板了。

三、设置触屏滑动事件(位置无限制)

<script type="text/javascript">
$("#page").on("swiperight", function() {        //我这里的#page是使用最大那个面板的id
//向右滑动,显示面板
$("#defaultpanel").panel("open");      //这里的#defaultpanel_right改成自己定义的面板的id
}); </script>

这样子,鼠标往右拉动就会弹出面板我们就完成了。

jQuery mobile 滑动打开面板的更多相关文章

  1. jQuery Mobile panel的相关属性

    参考网站:http://www.lampweb.org/jquerymobile/19/64.html 面板 data-role="panel" 在一个 jQuery Mobile ...

  2. jQuery Mobile Slider Widget 使用js控制

    jQuery Mobile 滑动条控件 基本用法不用多说了,看这里: http://www.runoob.com/jquerymobile/jquerymobile-form-sliders.html ...

  3. 主攻ASP.NET MVC4.0之重生:Jquery Mobile 面板

    左滑动面板效果: 右滑动面板效果: @{ ViewBag.Title = "JQuery Mobile Web Page"; } <!DOCTYPE html> < ...

  4. Jquery Mobile左右滑动效果

    首先在一个页面里面定义两个< div data-role="page">,这里为了突出重点,就没有写出footer和header.定义的页面如下: <body&g ...

  5. jquery mobile左右滑动切换页面

    jquery mobile左右滑动切换页面 $(function() {$("body").bind('swiperight', function() {  $.mobile.ch ...

  6. 小白学jquery Mobile《构建跨平台APP:jQuery Mobile移动应用实战》连载四(场景切换)

    作为一款真正有使用价值的应用,首先应该至少有两个页面,通过页面的切换来实现更多的交互.比如手机人人网,打开以后先是进入登录页面,登录后会有新鲜事,然后拉开左边的面板,能看到相册.悄悄话.应用之类的其他 ...

  7. jquery mobile自己定义webapp开发实例(一)——前言篇

    用jquery mobile做了一段时间的webapp开发,准备用自己的一个小demo做一个模块化的分享 点击demo演示 手机演示二维码: 此demo已经是比較老的版本号,用户体验流畅度确实还存在非 ...

  8. 白学jquery Mobile《构建跨平台APP:jQuery Mobile移动应用实战》串行4(场景变化)

    作为一个真正的利用价格值应用,首先,你应该至少有两页,通过切换页面来实现很多其他互动.比如手机人人网,首先,打开后进入登录页面,将有登录后,新的东西.然后拉左侧面板.你可以看到相册.私人信息.像其他应 ...

  9. jQuery Mobile 所有data-*选项,开发全解+完美注释

    全栈工程师开发手册 (作者:栾鹏) jQuery Mobile事件全解 jQuery Mobile 所有class选项 jQuery Mobile 所有data-*选项 jQuery Mobile 所 ...

随机推荐

  1. C#中Console.ReadLine()和Console.Read()有何区别?

    Console.Read 表示从控制台读取字符串,不换行. Console.ReadLine 表示从控制台读取字符串后进行换行. Console.Read() Console.ReadLine()方法 ...

  2. [C/C++] 大小端存储问题

    首先来看一下今天做的一道题: 解析: union 维护足够的空间来置放多个数据成员中的“一种”,而不是为每一个数据成员配置空间,在union 中所有的数据成员共用一个空间,同一时间只能储存其中一个数据 ...

  3. 7款很棒的 HTML5 视频播放器

    做个连接:http://www.cnblogs.com/lhb25/archive/2011/06/27/7-great-html-5-video-player-scripts.html

  4. CCS3 动画-鼠标放上去放大背景图片

    ---〉 效果如上,一个简单的过渡放大效果, <!DOCTYPE HTML> <html> <body> <style> #test{ width:30 ...

  5. Keil MDK中Image~~RW_IRAM1~~ZI~~Limit(~表示$)

    ARM程序的组成 此处所说的“ARM程序”是指在ARM系统中正在执行的程序,而非保存在ROM中的bin映像(image)文件,这一点清注意区别.            一个ARM程序包含3部分:RO, ...

  6. 【bzoj2274】[Usaco2011 Feb]Generic Cow Protests dp+树状数组

    题目描述 Farmer John's N (1 <= N <= 100,000) cows are lined up in a row andnumbered 1..N. The cows ...

  7. Android 手势识别

    public class MyGesture extends SimpleOnGestureListener { private GestureDetector gd; // onGestureLis ...

  8. BZOJ1053:[HAOI2007]反素数——题解

    http://www.lydsy.com/JudgeOnline/problem.php?id=1053 对于任何正整数x,其约数的个数记作g(x).例如g(1)=1.g(6)=4.如果某个正整数x满 ...

  9. Spring中事务传播行为类型

    Spring在TransactionDefinition接口中规定了7种类型的事务传播行为,它们规定了事务方法和事务方法发生嵌套调用时事务如何进行传播: 事务传播行为类型 说明 PROPAGATION ...

  10. 【区间DP】【lgP3146】248

    传送门 Description 给定一个1*n的地图,在里面玩2048,每次可以合并相邻两个(数值范围1-40),问最大能合出多少.注意合并后的数值并非加倍而是+1,例如2与2合并后的数值为3. In ...