移动端 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
随机推荐
- js报错:email() is not a function
email() is not a function 明明是一个函数,但火狐控制台真J.. 由于JSP文件是别人写好直接使用的,所以,来回测试,折腾!最后,没办法,一段一段代码删除测试,才发现.有for ...
- 程序内部让用户直接上appstore评价游戏的链接地址以及跳转方法
NSString *str = [NSString stringWithFormat:@"itms-apps://ax.itunes.apple.com/WebObjects/MZStore ...
- Three.js入门
一.前段时候花了些功夫研究了下WebGL,了解了基本实体的实现原理和实现方法,现在回忆就只记得如果要我画个圆形,怀疑都要了我的命(那得画多少个三角形...).功夫不负有心人,今天学习Three.js得 ...
- GIS的发展
2016年2月15日,博客园的blog申请成功了,这是我的第一篇随笔,发一个GIS的发展的视频链接 http://buluo.qq.com/p/detail.html?bid=15060&pi ...
- 史上最简单的socket
1. client import java.io.IOException; import java.io.OutputStream; import java.net.Socket; import ja ...
- C#多线程开发中如何更新UI界面控件内容
子线程不能修改UI线程的状态(比如文本框里面的内容). 解决的办法是写一个用来更新文本框内容的函数,然后在Worker线程里面通过BeginInvoke来利用delegate调用这个函数更新文本框. ...
- PKU 1005
比较简单吧,其实算是数学问题了 // 1005.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include "stdio.h ...
- MAC按键以及快捷键
使用普通的非Mac自带的键盘的同志们,想要在Mini Mac上面想要使用键盘,则推荐使用Mac系统自带的虚拟键盘,这样就可以查看普通键盘上每个键对应的Mac系统上是什么. 查看Mac系统上的虚拟键盘的 ...
- Python 学习记录----利用Python绘制奥运五环
import turtle #导入turtle模块 turtle.color("blue") #定义颜色 turtle.penup() #penup和pendown()设置画笔抬起 ...
- OD调试16
今天还是15的那个程序,但是呢,换一种方法去掉NAG窗口 用OD载入,暂停,查看调用的堆栈 先看最后一个 查看调用,下断点 往上看看,找到入口的地方,设下断.点,重载,运行,单步 通过单步发现 ...