HTML5手机上下滑动翻页特效是一款手机移动端触屏滑动效果实现完整代码如下:
1、html5页面代码
<!DOCTYPE html>
<html><head><meta http-equiv="Content-Type" content="text/htmlcharset=UTF-8">
<title>HTML5手机页面触屏滑动上下翻页特效</title>
<meta charset="utf-8">
<meta name="apple-touch-fullscreen" content="YES">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta http-equiv="Expires" content="-1">
<meta http-equiv="pragram" content="no-cache">
<link rel="stylesheet" type="text/css" href="./hamer_files/main.css">
<link rel="stylesheet" type="text/css" href="./hamer_files/endpic.css">
<script type="text/javascript" src="./hamer_files/offline.js"></script>
<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">
</head>
<body class="s-bg-ddd pc no-3d perspective yes-3d" style="-webkit-user-select: none">
<section class="u-alert">
<img style="display:none" src="./hamer_files/loading_large.gif">
<div class="alert-loading z-move">
<div class="cycleWrap"> <span class="cycle cycle-1"></span>
<span class="cycle cycle-2"></span><span class="cycle cycle-3"></span><span class="cycle cycle-4"></span>
</div>
<div class="lineWrap"> <span class="line line-1"></span><span class="line line-2"></span><span class="line line-3"></span>
</div>
</div>
</section>
<section class="u-arrow">
<p class="css_sprite01"></p>
</section>
<section class="p-ct transformNode-2d transformNode-3d" style="height: 918px">
<div class="translate-back" style="height: 918px">
<div class="m-page m-fengye" data-page-type="info_pic3" data-statics="info_pic3" style="height: 918px">
<div class="page-con lazy-finish" data-position="50% 50%" data-size="cover" style="height: 920pxbackground-image: url(hamer_files/1.jpg)background-size: coverbackground-position: 50% 50%"></div>
</div>
<div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">
<div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/2.jpg)background-size: coverbackground-position: 50% 50%"></div>
</div>
<div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">
<div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/3.jpg)background-size: coverbackground-position: 50% 50%"></div>
</div>
<div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">
<div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/4.jpg)background-size: coverbackground-position: 50% 50%"></div>
</div>
<div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">
<div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/5.jpg)background-size: coverbackground-position: 50% 50%"></div>
</div>
<div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">
<div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/6.jpg)background-size: coverbackground-position: 50% 50%"></div>
</div>
<div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">
<div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/7.jpg)background-size: coverbackground-position: 50% 50%"></div>
</div>
<div class="m-page m-bigTxt f-hide" data-page-type="bigTxt" data-statics="info_list" style="height: 918px">
<div class="page-con j-txtWrap lazy-finish" data-position="50% 50%" data-size="cover" style="background-image: url(hamer_files/8.jpg)background-size: coverbackground-position: 50% 50%"></div>
</div>
</div>
</section>
<section class="u-pageLoading">
<img src="./hamer_files/load.gif" alt="loading">
</section>
<script src="./hamer_files/init.mix.js" type="text/javascript" charset="utf-8"></script>
<script src="./hamer_files/coffee.js" type="text/javascript" charset="utf-8"></script>
<script src="./hamer_files/99_main.js" type="text/javascript" charset="utf-8"></script>
</body></html>
2、css代码:
@charset "utf-8"
.ad_foot li { margin:0 auto 1emfont-size:1.8empadding:15pxbackground:#FFF}
.ad_foot li a {display:block}
.ad_foot li .l {width:75pxheight:75pxfloat:leftoverflow:hidden}
.ad_foot li .l img {width:75pxwidth:75px}
.ad_foot li .r {width:78%float:leftmargin-left:30pxcolor:#666overflow:hidden}
.ad_foot li .r p {color:#999font-size:1.2em}
.ad_foot li .r span {font-size:0.8em}
.ad_foot li .r i {font-style:normal}
.lazy-img, .lazy-finish{background-color:#f0eded}
.page-list{font-size:20pxfont-family: "Microsoft yahei"padding-left:17pxpadding-top:30pxheight:35pxborder-bottom:1px solid #b5b5b5display:none}
.ad_foot{padding:15px 15px 0 15px}
/*声音播放按钮*/
#song_img {width:293pxheight:41pxdisplay:blockposition:absoluteright:4.1emtop:1.6emfont-size:1.7emtext-align:centerline-height:41pxcolor:#FFFbackground:url(../img/music_c3.png) no-repeat 0 0}
/*底部推荐*/
.ad_list{margin-top:2em}.ad_list li {width:46%background:nonepadding:0float:leftmargin-bottom: 1em}
.ad_list li.r {float:right}.ad_list li a img {width:100%height:auto}
.ad_foot h3 {width:100%height:48pxline-height:48pxbackground:#F9F5EC}
.ad_foot h3 a {display:inline-blockcolor:#444width:50%text-align:centerfont-size:1.5emheight:48pxborder-bottom:2px solid #FF9240}
.ad_foot h3 a.active {color:#FFFbackground:#FF9240}
.magazine_1 li {
width:100%
margin-bottom: 1em
font-size: 1.8em
padding: 15px
background: #FFF}
.magazine_1 li a {display:block}
.magazine_1 li .l {width: 75px
height: 75px
float: left
overflow: hidden}
.magazine_1 li .l img {width:75pxheight:75px}
.magazine_1 li .r {width: 78%
float: left
margin-left: 30px
color: #666
overflow: hidden}
.magazine_1 li .r p {
color: #999
font-size: 1.2em
.magazine_1 li .r span {font-size:0.8em}
.ad_foot li .r i {font-style:normal}
3、运行效果如下:
使用浏览器可以进行手机效果测试:
现在各大浏览器都有这种功能了, 谷歌、QQ、360搜狐等;
首先打开网页,点击右键列表里会有“审查元素”,再点击手机那个按钮,就可以调整屏幕宽度查看手机效果。
使用html5开发一个动态网站方法:工具/原料HBuilder6.6MUI2.5方法/步骤为了演示HTML5APP页面是如何做到动态调整布局。1、首先,我们创建一个移动APP项目,然后,添加一个index.html页面。代码里,添加一个图标,以及添加引入一个JS文件,该文件的作用在于:请求后台JS文件。2、接下来,我们看看service.js文件是如何请求后台JS文件的。编写该service.js文件的重点是:A、如何异步请求后台JS文件;B、请求回来的后台文件,如何动态添加到页面的Head里。3、紧接着,我们对APP项目进行打包 *** 作:选择需要的打包类型,然后,填写相应的证书信息。如果选择IOS打包,请在打包证书里,添加需要安装的苹果手机UDID(未提供UDID,则不能安装APP)。4、打包完成后,便可以下载安装APP。先用苹果手机连接电脑,然后通过工具安装APP。当然,这种连接数据线安装的方式,只能适合个人测试使用。如果想给别人批量安装测试,请参考《HTML5APP开发之APP测试》经验。1HTML5APP开发之APP测试5、APP安装完成后,我们看看打开APP现有的效果是怎样的。我们看到APP页面的左上角,显示了一个联系人的图标。6、由于菜果手机不同系列的屏幕大小不一样,而且屏幕的分辨率也不一样【安桌手机的也一样】。导致同一个页面布局,在不同的手机上,显示的位置有时偏差比较大,有时也好。当然,这也加大了开发和测试的难度。不可能因一些位置问题,就重新发布APP。下面是苹果手机不同系列的屏幕大小分辨率说明:7、所以,才有了动态调试页面布局的想法。回到第二步,我们是有请求后台JS文件的(showJSPage.js)。下面看看showJSPage.js,是如何编写的:A、首先判断手机 *** 作系统类型;B、判断屏幕大小。8、添加了showJSPage.js代码后,启动后台服务。然后,关闭原来打开的APP软件,再重新打开APP软件,便可查看修改后的效果。9、整个方案的理解重点在于:熟悉JS执行的先后顺序,以及对手机屏幕大小与屏幕分辨率的关系。才能灵活运用,达到自己想要的目的。欢迎分享,转载请注明来源:内存溢出
评论列表(0条)