jQuery mobile 滑动打开面板
一、首先在<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 滑动打开面板的更多相关文章
- jQuery Mobile panel的相关属性
参考网站:http://www.lampweb.org/jquerymobile/19/64.html 面板 data-role="panel" 在一个 jQuery Mobile ...
- jQuery Mobile Slider Widget 使用js控制
jQuery Mobile 滑动条控件 基本用法不用多说了,看这里: http://www.runoob.com/jquerymobile/jquerymobile-form-sliders.html ...
- 主攻ASP.NET MVC4.0之重生:Jquery Mobile 面板
左滑动面板效果: 右滑动面板效果: @{ ViewBag.Title = "JQuery Mobile Web Page"; } <!DOCTYPE html> < ...
- Jquery Mobile左右滑动效果
首先在一个页面里面定义两个< div data-role="page">,这里为了突出重点,就没有写出footer和header.定义的页面如下: <body&g ...
- jquery mobile左右滑动切换页面
jquery mobile左右滑动切换页面 $(function() {$("body").bind('swiperight', function() { $.mobile.ch ...
- 小白学jquery Mobile《构建跨平台APP:jQuery Mobile移动应用实战》连载四(场景切换)
作为一款真正有使用价值的应用,首先应该至少有两个页面,通过页面的切换来实现更多的交互.比如手机人人网,打开以后先是进入登录页面,登录后会有新鲜事,然后拉开左边的面板,能看到相册.悄悄话.应用之类的其他 ...
- jquery mobile自己定义webapp开发实例(一)——前言篇
用jquery mobile做了一段时间的webapp开发,准备用自己的一个小demo做一个模块化的分享 点击demo演示 手机演示二维码: 此demo已经是比較老的版本号,用户体验流畅度确实还存在非 ...
- 白学jquery Mobile《构建跨平台APP:jQuery Mobile移动应用实战》串行4(场景变化)
作为一个真正的利用价格值应用,首先,你应该至少有两页,通过切换页面来实现很多其他互动.比如手机人人网,首先,打开后进入登录页面,将有登录后,新的东西.然后拉左侧面板.你可以看到相册.私人信息.像其他应 ...
- jQuery Mobile 所有data-*选项,开发全解+完美注释
全栈工程师开发手册 (作者:栾鹏) jQuery Mobile事件全解 jQuery Mobile 所有class选项 jQuery Mobile 所有data-*选项 jQuery Mobile 所 ...
随机推荐
- Ninject学习资料
https://github.com/ninject/Ninject/wiki/Modules-and-the-Kernel http://www.cnblogs.com/willick/p/3223 ...
- SonarQube安装
要求 至少1G以上内存,推荐为2G Java:Oracle JRE 7u75+,OpenJDK 7u75+ 数据库: Microsoft SQL Server 2008/2012/2014 MySQL ...
- 【EF】解决EF批量操作,Z.EntityFramework.Extensions 过期方案
方案一: 使用EntityFramework.Extended优点: 启下载量是Z.EntityFramework.Extensions的10倍+ 不会过期缺点:不能批量Insert 方案二:解决批量 ...
- javaBean默认接受request发送过来的数据,根据键自动设置属性
javaBean默认接受request发送过来的数据,根据键自动设置属性
- BZOJ 1407 Savage(拓展欧几里得)
这题的时间复杂度真玄学... O(m*n^2).1e8也能过啊... 首先题目保证m<=1e6. 这启发我们枚举或者二分答案? 但是答案不满足单调性,考虑从小到大枚举m. 对于每一个m,枚举两个 ...
- 【Luogu】P2901牛慢跑(K短路模板)
题目链接 K短路居然用A*……奇妙. 先建反图从终点(1)跑一遍最短路,再A*,用堆存当前点到终点距离+从起点到当前点距离. 每次取出终点都可以视为发现了一个新的最短路. #include<cs ...
- Trie字典树的学习及理解
字典树详解见此 我这里学习时主要是看了李煜东的进阶指南里的讲解,以下是书中介绍的内容. Trie,又称字典树,是一种用于实现字符串快速检索的多叉树结构,Tire的每个节点都拥有若干个字符指针,若在插入 ...
- 转:关于Latent Dirichlet Allocation及Hierarchical LDA模型的必读文章和相关代码
关于Latent Dirichlet Allocation及Hierarchical LDA模型的必读文章和相关代码 转: http://andyliuxs.iteye.com/blog/105174 ...
- Android 解决setRequestedOrientation之后手机屏幕的旋转不触发onConfigurationChanged方法
最近在做播放器的时候遇到一个问题,在屏幕方向改变之后需要切换播放器全屏/非全屏的时候,在重写了onConfigurationChanged方法并在manifest.xml配置文件中添加 android ...
- BZOJ1823:[JSOI2010]满汉全席——题解
https://www.lydsy.com/JudgeOnline/problem.php?id=1823 https://www.luogu.org/problemnew/show/P4171 题面 ...