移动端 touch 事件的originalEvent
对于移动端的触摸事件,我们通过touchstart、touchmove、touchend实现,PC端一般使用mousedown、mousemove、mouseup实现。
我们获取事件坐标,原生js获取方式
| mousedown | event.pageX |
| mousemove | event.pageX |
| mouseup | event.pageX |
| touchstart | event.touches[0].pageX & event.changedTouches[0].pageX & event.targetTouches[0].pageX |
| touchmove | event.touches[0].pageX & event.changedTouches[0].pageX & event.targetTouches[0].pageX |
| touchend | event.touches[0].pageX & event.changedTouches[0].pageX & event.targetTouches[0].pageX |
jQuery获取方式
| mousedown | event.pageX |
| mousemove | event.pageX |
| mouseup | event.pageX |
| touchstart | event.originalEvent.touches[0].pageX & event.originalEvent.changedTouches[0].pageX & event.originalEvent.targetTouches[0].pageX |
| touchmove | event.originalEvent.touches[0].pageX & event.originalEvent.changedTouches[0].pageX & event.originalEvent.targetTouches[0].pageX |
| touchend | event.originalEvent.changedTouches[0].pageX & event.originalEvent.targetTouches[0].pageX |
其中关于touch触摸事件的触摸列表:
touches :当前位于屏幕上的所有手指的一个列表。
targetTouches :位于当前DOM元素上的手指的一个列表。
changedTouches :涉及当前事件的手指的一个列表。
对于jQuery中在移动端获取坐标使用的event.originalEvent,有以下:
It's also important to note that the event object contains a property called originalEvent, which is the event object that the browser itself created. jQuery wraps this native event object with some useful methods and properties, but in some instances, you'll need to access the original event via event.originalEvent for instance. This is especially useful for touch events on mobile devices and tablets.
event.originalEvent is usually just the native event (also described here).
However, if the browser is compatible, and the event was a touch event then that API will be exposed through event.originalEvent.
The short answer is that event.originalEvent is not always the same, it depends on which event type triggered the handler, and on the environment of the browser.
关于event.originalEvent说明的地址链接:http://stackoverflow.com/questions/16674963/event-originalevent-jquery
关于touch事件的补充内容地址链接:http://blog.csdn.net/clh604/article/details/9861411
移动端 touch 事件的originalEvent的更多相关文章
- H5案例分享:移动端touch事件判断滑屏手势的方向
移动端touch事件判断滑屏手势的方向 方法一 当开始一个touchstart事件的时候,获取此刻手指的横坐标startX和纵坐标startY: 当触发touchmove事件时,在获取此时手指的横坐标 ...
- 原生js移动端touch事件实现上拉加载更多
大家都知道jQuery里没有touch事件,所以在移动端使用原生js实现上拉加载效果还是很不错的,闲话不多说,代码如下: //获取要操作的元素 var objSection = document.ge ...
- 移动端touch事件影响click事件以及在touchmove添加preventDefault导致页面无法滚动的解决方法
这两天自己在写一个手机网页,用到了触屏滑动的特效,就是往右滑动的时候左侧隐藏的菜单从左边划出来. 做完之后在手机原生浏览器中运行正常,但在QQ和微信中打开,发现touchmove只会触发一次,而且to ...
- 移动端Touch事件基础
1.三个常用的移动端事件 ontouchstart 手指按下时触发 ontouchmove 手指移动时触发 ontouchend 手动抬起时触发 注意:这些事件当作事件属性使用时,不兼容谷歌浏览器. ...
- 移动端touch事件 || 上拉加载更多
前言: 说多了都是泪,在进行项目开发时,在上拉加载更多实现分页效果的问题上,由于当时开发任务紧急,所以就百度找了各种移动端的上拉下拉 实现加载更多的插件.然后就留下了个坑:上拉加载的时候会由于用户错误 ...
- 移动端touch事件实现页面弹动--小插件
动手之前的打盹 说实话真的是好久没有更新博客了,最近一直赶项目,身心疲惫:最关键的是晚上还要回去上一波王者,实在是忙啊! 这周下来,清闲了些许,或许是因为要到国庆的缘故吧,大家都显得无精打采.俗话说的 ...
- 移动端 Touch 事件
在移动端页面开发时,常常会用到touch事件,比如左滑右滑的轮播等.常用的触摸事件有touchstart,touchmove,touchend. 每个事件包含下面三个用于跟踪虎摸的属性: touche ...
- 移动端touch事件封装
<meta charset="utf-8"><meta name="viewport" content="width=device- ...
- 移动端--touch事件与点透问题
也来说说touch事件与点击穿透问题: http://blog.csdn.net/alex8046/article/details/52299785
随机推荐
- mac idea中 maven项目添加的时候没有java文件
file --other setting --maven 选中第二项即可 apply下
- linux -a 到 -z 的意义
shell if判断中常用的也就是绿色部分,尾部部分越看越不懂.从百度文库转载. [ -a FILE ] 如果 FILE 存在则为真. [ -b FILE ] 如果 FILE 存在且是一个块特殊文件则 ...
- 网易云课堂JS笔记
JS能做什么?? ----网易官网:选项卡----京东: Hbuilder编辑器介绍 JavaScript简介 ECMAScript:javaScript组成语法和基本对象 DOM:文档对象模型,描述 ...
- Java web 项目的相对路径的使用
在java Web中有些地方读取文件需要相对路径.在Java Web 中如何使用相对路径呢? Java Web 在发布项目的时候. 发布根路径下WEB-INF/classes 默认使用该方法的路径是: ...
- git clone错误
git clone错误 Initialized empty Git repository in ***/.git/ error: The requested URL returned error: 4 ...
- [解决方案] pythonchallenge level 3
http://www.pythonchallenge.com/pc/def/equality.html 根据页面提示:一个小写字母刚刚好被左右3个大写字母包围. 查看页面代码得到需要处理的字符. 将字 ...
- Mysql 根据时间戳、时间按年月日分组统计
create_time时间格式 SELECT DATE_FORMAT(create_time,'%Y%u') weeks,COUNT(id) COUNT FROM role GROUP BY week ...
- mysql5.7 zip版的配置方法
下载了最新版的mysql,发现配置后使用net start mysql 服务无法启动,花了点时间找到了解决方案,按照如下步骤就可以了,关键在于创建data文件夹以及mysqld --initializ ...
- BZOJ 2743 树状数组
不能用分块. #include <bits/stdc++.h> using namespace std; ; struct Info{int l,r,Id;}Q[Maxn]; int a[ ...
- java经典题目
/***********Ryear.java begin********************/ import java.util.Scanner;public class Ryear { /** ...