利用JQuery Mobile实现切换效果
来源:互联网 发布:js鼠标右键弹出菜单 编辑:程序博客网 时间:2024/06/08 08:18
效果图
按左右方向和鼠标滑动键即可切换至第二页
效果图:
代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><!--学习方法总结:准备:调试运行Demo程序模仿:1.做好简单的布局 2.根据思路依次写脚本语句--><html xmlns="http://www.w3.org/1999/xhtml"><head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title>Slides-Phone</title> <link href="css/jquery.mobile-1.3.1.css" rel="stylesheet" type="text/css" /> <!--<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.1/jquery.mobile-1.1.1.css" />--> <script src="js/jquery-1.7.1.js" type="text/javascript"></script> <script src="js/jquery.mobile-1.1.0.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { /*******前进,后退,主页,尾页*******/ var goBack = function() { if ($.mobile.activePage.next(':jqmData(role=page)').length > 0) { //先获取活动页面的下一页(筛选符合role=page),并设置相应的过度效果 $.mobile.changePage($.mobile.activePage.next(':jqmData(role=page)'), { transition: $.mobile.activePage.next(':jqmData(role=page)').jqmData('transition') }); } } var goForward = function() { if ($.mobile.activePage.prev(':jqmData(role=page)').length > 0) { $.mobile.changePage($.mobile.activePage.prev(':jqmData(role=page)'), { transition: $.mobile.activePage.prev(':jqmData(role=page)').jqmData('transition') }); } } var goHome = function() { if ($(':jqmData(role=page):first').length > 0) { $.mobile.changePage($(':jqmData(role=page):first')); } } var goLast = function() { if ($(':jqmData(role=page):last').length > 0) { $.mobile.changePage($(':jqmData(role=page):last')); } } /*******end*******/ /*******注册键盘和滑动事件*******/ $(document).keydown(function(e) { if (e.keyCode == 39) { goForward(); } else if (e.keyCode == 37) { goBack(); } }).bind("swiperight", goBack) //goBack函数必须要放在此之前声明 .bind("swipeleft", goForward); /*******end*******/ /*******延迟加载图片*******/ //待续..... /*******end*******/ /*******优化页面*******/ //待续..... /*******end*******/ }); </script></head><body> <div data-role="page" id="slide1" data-theme="a"> <div data-role="header" data-position="fixed"> <h1> slide1</h1> </div> <div data-role="content"> <img src="images/陈大师_small.png" /> <h1> slide1 </h1> <p> content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content </div> <div data-role="footer" data-position="fixed"> <h4> Footer1</h4> </div> </div> <div data-role="page" id="slide2" data-theme="c"> <div data-role="header" data-position="fixed"> <h1> slide2</h1> </div> <div data-role="content"> <img src="images/陈大师.jpg" /> <h1> slide2 </h1> <p> content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content content </div> <div data-role="footer" data-position="fixed"> <h4> Footer2</h4> </div> </div></body></html>
- 利用JQuery Mobile实现切换效果
- Jquery Mobile实现页面切换
- JQuery Mobile实现滑动屏幕切换页面
- jQuery实现图片切换效果
- jQuery实现图片切换效果
- jquery实现标签切换效果
- Jquery 实现手风琴切换效果
- 利用Jquery实现tab效果
- 利用Jquery实现百叶窗效果
- 利用jquery的attr方法一行代码实现的简单的图片切换效果
- 利用ViewFlipper实现屏幕切换动画效果
- 利用JavaScript,实现卡片切换的效果
- jQuery mobile手風琴折疊效果
- jQuery Mobile 过渡效果
- jquery 实现图片切换幻灯片效果
- jquery插件实现面板切换效果
- 使用jquery实现图文切换效果
- 利用jquery写的一个TAB页切换效果
- C#部分关键字归纳
- php中 curl, fsockopen ,file_get_contents 三个函数
- Android学习-应用程序管理
- C++的位运算
- STM32F10x 调试口释放
- 利用JQuery Mobile实现切换效果
- unity3d 虚拟现实在各行业的应用
- [各种面试题] 一个不能少:From陈利人先生微博面试题
- recovery代码分析之二
- org.springframework.util.Assert
- C#中使用Graphics画图的Matrix变换错误分析(持续更新中)
- Android_OTT的wifi热点建立
- recovery代码分析之三:try_update_binary
- HTTP协议header头域