js实现页面的上滑下拉功能
这两天做项目,用到了上滑和下拉的功能,主要是通过监听touchmove,touchstart,touchend三个事件去判断页面上滑状态还是下拉状态。
同时加一个知识点:有时在监听时会报错,这个错是这样子的:
[Intervention] Unable to preventDefault inside passive event listener due to target being treated as passive. See https://www.chromestatus.com/features/5093566007214080;
这种错误出现的原因,大家可以点击这个链接https://segmentfault.com/a/1190000008512184 去看一下,写的挺好的
这里呢,我就直接把代码贴一下。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=640, user-scalable=no">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-title" content="">
<title>H5-test</title>
<link href="css.css" rel="stylesheet" />
</head> <body> <div class="page_box">
<div class="page page1">
<div>
<div>11111111111</div>
<div>11111111111</div>
<div>11111111111</div>
<div>11111111111</div>
<div>11111111111</div>
<div>11111111111</div>
<div>11111111111</div>
<div>11111111111</div>
<div>11111111111</div>
<div>11111111111</div>
</div>
</div> <div class="page page2 hide">
<div>
<div>22222222222</div>
<div>22222222222</div>
<div>22222222222</div>
<div>22222222222</div>
<div>22222222222</div>
<div>22222222222</div>
<div>22222222222</div>
<div>22222222222</div>
<div>22222222222</div>
<div>22222222222</div>
</div>
</div> <div class="page page3 hide">
<div>
<div>33333333333</div>
<div>33333333333</div>
<div>33333333333</div>
<div>33333333333</div>
<div>33333333333</div>
<div>33333333333</div>
<div>33333333333</div>
<div>33333333333</div>
<div>33333333333</div>
<div>33333333333</div>
</div>
</div> <div class="page page4 hide">
<div>
<div>44444444444</div>
<div>44444444444</div>
<div>44444444444</div>
<div>44444444444</div>
<div>44444444444</div>
<div>44444444444</div>
<div>44444444444</div>
<div>44444444444</div>
<div>44444444444</div>
<div>44444444444</div>
</div>
</div> <div class="page page5 hide">
<div>
<div>55555555555</div>
<div>55555555555</div>
<div>55555555555</div>
<div>55555555555</div>
<div>55555555555</div>
<div>55555555555</div>
<div>55555555555</div>
<div>55555555555</div>
<div>55555555555</div>
<div>55555555555</div>
</div>
</div> <div class="page page6 hide">
<div>
<div>66666666666</div>
<div>66666666666</div>
<div>66666666666</div>
<div>66666666666</div>
<div>66666666666</div>
<div>66666666666</div>
<div>66666666666</div>
<div>66666666666</div>
<div>66666666666</div>
<div>66666666666</div>
</div>
</div>
</div> <div class="arrow">∧</div> <script type="text/javascript" src="https://cdn.bootcss.com/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript"> document.addEventListener("touchmove", function(e){
e.preventDefault();
} , false,{ passive: true }); var curPage = 1;
var PageL = $('.page_box .page').length;
var canTouch = false;
canTouch = true; var startY , endY , diff;
document.body.addEventListener("touchstart", touchStart, false,{ passive: true });
document.body.addEventListener("touchmove", touchMove, false,{ passive: true });
document.body.addEventListener("touchend", touchEnd, false,{ passive: true });
function touchStart(e){
var touch = e.touches[0];
startY = touch.pageY;
}
function touchMove(e){
//e.preventDefault();
var touch = e.touches[0];
endY = touch.pageY;
diff = endY - startY;
}
function touchEnd(e){
if(Math.abs(diff) > 150 && canTouch){
if(diff > 0){
if(curPage <= 1){
return;
} $('.page' + curPage).removeClass('inTop outTop inDown outDown hide').addClass('outDown');
curPage--;
$('.page' + curPage).removeClass('inTop outTop inDown outDown hide').addClass('inDown'); }else{
if(curPage >= PageL){
return;
} $('.page' + curPage).removeClass('inTop outTop inDown outDown hide').addClass('outTop');
curPage++;
$('.page' + curPage).removeClass('inTop outTop inDown outDown hide').addClass('inTop'); if(curPage >= PageL){
$('.arrow').hide();
}else{
$('.arrow').show();
}
}
canTouch = false;
setTimeout(function(){
canTouch = true;
diff = 0;
$('.page' + (curPage - 1) + ', .page' + (curPage + 1)).addClass('hide');
},1000);
}
}
</script>
</body>
</html>
css样式
@charset "utf-8";
*{ margin:0px; padding:0px; box-sizing:border-box; -webkit-tap-highlight-color:rgba(0,0,0,0);}
html{ max-width:640px; margin:0 auto;}
body{ font-family:"PingFangSC-Regular","sans-serif","STHeitiSC-Light","微软雅黑","Microsoft YaHei"; font-size:50px; line-height:1.5em; color:#212121;
-webkit-user-select:none; user-select:none;
-webkit-touch-callout:none; touch-callout:none;
}
html , body , .page_box{ width:100%; height:100%; position:relative; overflow:hidden;}
.page{ background:url(data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wgARCAAkAn8DAREAAhEBAxEB/8QAGwABAQEBAQEBAQAAAAAAAAAAAAUGBAMCAQn/xAAdAQEAAwEBAQEBAQAAAAAAAAAABAUGBwMBAggJ/9oADAMBAAIQAxAAAAH+gH+J/wDWgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA97WJsOoZvEca14At7ij9ZDP8/vABs+u5TL8/vOSingelhF2fWM1iOL68AV9pTdtr4Zvm2gAGw65lc1hLvkz08D7leO06/lsRxbXgAAPVu+0ZDCcX17yAU9TV2dTXZPlulAGr6bmo+cspmVswBu+25DCcb1SN6gUNNWW9fW5TlWlAGo6Tnp9NJj4+4AG37RkcXyfSecSTU0tbMytmAPe4ien35yU0wAU9JWS6ab+xPYAV9fVyMhaAD3s4npJ8+SjngChpqydSTf2J7ACprqyXkbMAAAV9dUSMjbgD0nxeuy8eDPWAA69DA5630+IEsAWNdTx8jcAD0lReu78uDNTwB2X0DyienhWSwBT19XMyFoAKmprKmkhZfmWgAGr6jmo+XsZmWtAHq3faMhhOJa8AU9VV2dTXZPlmlAGo6bn52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7mlaIZ1sJ2En1uKRWLFgFjkBT1F0jrAREOtBCjDIBEKJTV3XwoX1dOQENVZOONAKR1F3q8gdbgykEAEUQEdIiOVXJ2dCYjIbrLVgBHCpAU9R+eoCBiIRN0OjBH4ZJVYg1iYuolWpvTLlbAQQe3U40ZmGIzOzo4kzDbhLEHk3S8RxGB9hBggahRPIujheEphJFXf//Z) repeat-y; background-size:100%;}
.page{ display:flex; justify-content:center; align-items:center; width:100%; height:100%; position:absolute; left:0; top:0; overflow:hidden;}
.page.hide{ display:none;} /*==================================*/ .page.inTop{
-webkit-animation:ShowTop .5s ease-out both;
animation:ShowTop .5s ease-out both;
}
.page.outTop{
-webkit-animation:HideTop .5s ease-out both;
animation:HideTop .5s ease-out both;
}
.page.inDown{
-webkit-animation:ShowDown .5s ease-out both;
animation:ShowDown .5s ease-out both;
}
.page.outDown{
-webkit-animation:HideDown .5s ease-out both;
animation:HideDown .5s ease-out both;
}
@-webkit-keyframes ShowTop{
0%{ -webkit-transform:translateY(100%);}
100%{ -webkit-transform:translateY(0);}
}
@keyframes ShowTop{
0%{ transform:translateY(100%);}
100%{ transform:translateY(0);}
}
@-webkit-keyframes HideTop{
0%{ -webkit-transform:translateY(0);}
100%{ -webkit-transform:translateY(-100%);}
}
@keyframes HideTop{
0%{ transform:translateY(0);}
100%{ transform:translateY(-100%);}
}
@-webkit-keyframes ShowDown{
0%{ -webkit-transform:translateY(-100%);}
100%{ -webkit-transform:translateY(0);}
}
@keyframes ShowDown{
0%{ transform:translateY(-100%);}
100%{ transform:translateY(0);}
}
@-webkit-keyframes HideDown{
0%{ -webkit-transform:translateY(0);}
100%{ -webkit-transform:translateY(100%);}
}
@keyframes HideDown{
0%{ transform:translateY(0);}
100%{ transform:translateY(100%);}
} /*==================================*/ .arrow{ width:70px; height:56px; line-height:56px; text-align:center; font-size:50px; font-weight:bold; color:#d00; position:absolute; left:285px; bottom:10px;
-webkit-animation:arrow 1.2s .5s ease-in-out infinite;
animation:arrow 1.2s .5s ease-in-out infinite;
}
@-webkit-keyframes arrow{
0%{ -webkit-transform:translateY(0); opacity:1;}
100%{ -webkit-transform:translateY(-50%); opacity:0}
}
@keyframes arrow{
0%{ transform:translateY(0); opacity:1;}
100%{ transform:translateY(-50%); opacity:0}
} /*==================================*/ .page > div > div:nth-child(1){
-webkit-animation:fadeRightTan .8s .2s ease-in-out both;
animation:fadeRightTan .8s .2s ease-in-out both;
}
.page > div > div:nth-child(2){
-webkit-animation:fadeRightTan .8s .7s ease-in-out both;
animation:fadeRightTan .8s .7s ease-in-out both;
}
.page > div > div:nth-child(3){
-webkit-animation:fadeRightTan .8s 1.2s ease-in-out both;
animation:fadeRightTan .8s 1.2s ease-in-out both;
}
.page > div > div:nth-child(4){
-webkit-animation:fadeRightTan .8s 1.7s ease-in-out both;
animation:fadeRightTan .8s 1.7s ease-in-out both;
}
.page > div > div:nth-child(5){
-webkit-animation:fadeRightTan .8s 2.2s ease-in-out both;
animation:fadeRightTan .8s 2.2s ease-in-out both;
}
.page > div > div:nth-child(6){
-webkit-animation:fadeRightTan .8s 2.7s ease-in-out both;
animation:fadeRightTan .8s 2.7s ease-in-out both;
}
.page > div > div:nth-child(7){
-webkit-animation:fadeRightTan .8s 3.2s ease-in-out both;
animation:fadeRightTan .8s 3.2s ease-in-out both;
}
.page > div > div:nth-child(8){
-webkit-animation:fadeRightTan .8s 4.7s ease-in-out both;
animation:fadeRightTan .8s 4.7s ease-in-out both;
}
.page > div > div:nth-child(9){
-webkit-animation:fadeRightTan .8s 5.2s ease-in-out both;
animation:fadeRightTan .8s 5.2s ease-in-out both;
}
.page > div > div:nth-child(10){
-webkit-animation:fadeRightTan .8s 5.7s ease-in-out both;
animation:fadeRightTan .8s 5.7s ease-in-out both;
}
@-webkit-keyframes fadeRightTan{
0%{ -webkit-transform:translateX(100%); opacity:0;}
70%{ -webkit-transform:translateX(-5%); opacity:1;}
80%{ -webkit-transform:translateX(2%); opacity:1;}
90%{ -webkit-transform:translateX(-2%); opacity:1;}
100%{ -webkit-transform:translateX(0); opacity:1;}
}
@keyframes fadeRightTan{
0%{ transform:translateX(100%); opacity:0;}
70%{ transform:translateX(-5%); opacity:1;}
80%{ transform:translateX(2%); opacity:1;}
90%{ transform:translateX(-2%); opacity:1;}
100%{ transform:translateX(0); opacity:1;}
}
js实现页面的上滑下拉功能的更多相关文章
- ios position:fixed 上滑下拉抖动
ios position:fixed 上滑下拉抖动 最近呢遇到一个ios的兼容问题,界面是需要一个头底部的固定的效果,用的position:fixed定位布局,写完测试发现安卓手机正常的,按时ios上 ...
- Swiper 判断上滑下拉操作
onTouchMove: function(swiper){ //手动滑动中触发//判断上滑下拉var i = mySwiper.translate;setTimeout(function() {va ...
- jQuery点击页面其他部分隐藏下拉菜单
一.开发小要点 web页面中,我们一般不用select.option来实现下拉菜单效果,因为下拉框的样式丑且难以美化,所以我们选择控制ul显示隐藏来实现同样且高大上的效果,但是不能像下拉框那样点击页面 ...
- 让Jayrock插上翅膀(加入输入输出参数注释,测试页面有注释,下拉框可以搜索)
继上一篇文章介绍了Jayrock组件开发接口的具体步骤和优缺点之后,今天给大家带来的就是,如何修复这些缺点. 首先来回顾一下修复的缺点有哪些: 1.每个接口的只能写大概的注释,不能分开来写,如接口的主 ...
- jsp页面上的下拉框案例(Struts2)
<s:select></s:select>包含的属性有:list="" :name="" :value="" ...
- FineReport——JS二次开发(隐藏下拉框控件的倒三角)
在对FR控件进行二次开发的过程中,需要自定义样式,比如下拉框控件带有自动检索的功能,但是又希望它的显示样式如同文本框一样,这时就需要隐藏多余的部分. 在对在线文档的查阅中可以发现很多选择器适用于多种控 ...
- js不是从上到下执行的吗?
如果说js是从上到下解释执行的, 那么,按道理应该会执行错误前面的代码. 如: [代码一] //输出1,2,到3报错 console.log("一") console.log(&q ...
- js:jquery multiSelect 多选下拉框实例
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- [Ext JS 4] 实战之多选下拉单 (带checkbox)
前言 Ext js 创建一个多选下拉单的方式很简单, 使用Ext.form.ComboBox, 设置 multiSelect 为true 就可以了. 但是如果要在每个下拉之前加上一个checkbox, ...
随机推荐
- OC中RAC编程block的基本使用
在OC中block的基本使用 // // ViewController.h // RAC--test // // Created by Aaron on 17/1/17. // Copyright © ...
- 【转】Java中的代码点与代码单元
转载自:http://blog.csdn.net/xujinsmile/article/details/8526387 最近看core java,之前一直不明白,看了不少帖子和博客,总算搞明白了. J ...
- Android Weekly Notes Issue #316
July 1st, 2018 Android Weekly Issue #316 本期内容包含教你使用Kotlin通过Annotation Processor生成代码文件, JetPack中的Andr ...
- Android Weekly Notes Issue #319
Android Weekly Issue #319 July 22nd, 2018. Android Weekly Issue #319 本期内容包括: MotionLayout加动画; Kotlin ...
- 分布式任务调度平台XXL-Job搭建
下载: https://github.com/xuxueli/xxl-job 下载 然后倒入到自己的工程里面 引入后: 导入数据:跑一边 导入: 修改: Window -->show view- ...
- Spring Boot2.0之多数据源分布式事务问题
分布式事务解决方案的问题, 分布式事务产生的原因: 多个不同的服务连接不同的数据源 ,做分布式事务的管理. 这种情况是连接两个数据源的情况,然后事务管理器是这样的 只管理了test02的这端业务代码. ...
- Javascript类型转换的规则实例解析
http://www.jb51.net/article/79916.htm 类型转换可以分为隐式转换和显式转换,所谓隐式转换即程序在运行时进行的自动转换,显式转换则是人为的对类型进行强制转换.Java ...
- python类初探
class human: is_alive=True is_man=True def __init__(self,age): print('this is __init__() method, whi ...
- 时间序列数据库——索引用ES、聚合分析时加载数据用什么?docvalues的列存储貌似更优优势一些
加载 如何利用索引和主存储,是一种两难的选择. 选择不使用索引,只使用主存储:除非查询的字段就是主存储的排序字段,否则就需要顺序扫描整个主存储. 选择使用索引,然后用找到的row id去主存储加载数据 ...
- X-Forward-For ip
用 Firefox 的Moify Headers 插件 服务器重新配置X-Forward-For 为正确的值. 如对典型的nginx + php fastcgi 环境( nginx 与 php fas ...