$('#id').on('touchstart',function(e) {
var x= e.originalEvent.targetTouches[].pageX; });

JQuery如上。

document.getElementById("id").addEventListener("touchstart",function(e){
var _x=e.touches[].pageX;
var _y=e.touches[].pageY;
console.log("start",_x)
})

原生如上。

一般我们取第一个手指的坐标,如果有其他要求可能 需要判断手指数量

if (e.targetTouches.length == ){
  //...
}

常用的:

e.preventDefault();

参考来源:http://www.cnblogs.com/luoeeyang/p/4519408.html

JQuery获取touchstart,touchmove,touchend坐标的更多相关文章

  1. JQuery 获取touchstart,touchmove,touchend 坐标

    JQuery写法: $('#id').on('touchstart',function(e) { var _touch = e.originalEvent.targetTouches[0]; var ...

  2. 获取touchstart,touchmove,touchend 坐标

    简单说下如何用jQuery 和 js原生代码获取touchstart,touchmove,touchend 坐标值: jQuery 代码: $('#id').on('touchstart',funct ...

  3. jQuery的touchstart,touchmove,touchend的获取位置

    $('#webchat_scroller').on('touchstart',function(e) { var touch = e.originalEvent.targetTouches[0]; v ...

  4. 移动端的touchstart,touchmove,touchend事件中的获取当前touch位置

    前提:touchstart,touchmove,touchend这三个事件可以通过原生和jq绑定. 原生:document.querySelector("#aa").addEven ...

  5. jquery获取当前元素的坐标

    jquery获取当前元素的坐标 1,获取对象 var obj = $("#id号"); 或  var obj = $(this); 实例中我获取的对象是弹出窗口按钮,这样创建的新窗 ...

  6. 移动端touchstart,touchmove,touchend

    近段时间使用html5开发一个公司内部应用,而触摸事件必然是移动应用中所必须的,刚开始以为移动设备上或许也会支持鼠标事件,原来是不支持的,好在webkit内核的移动浏览器支持touch事件,并且打包成 ...

  7. touchstart,touchmove,touchend触摸事件的小小实践心得

    近段时间使用html5开发一个公司内部应用,而触摸事件必然是移动应用中所必须的,刚开始以为移动设备上或许也会支持鼠标事件,原来是不支持的,好在webkit内核的移动浏览器支持touch事件,并且打包成 ...

  8. 利用jQuery获取鼠标当前的坐标

    文字来源:http://www.smalluv.com/jquery_code_106.html jQuery获取当前鼠标坐标位置: <div id="testDiv"> ...

  9. touchstart,touchmove,touchend事件 写法

    jQuery写法: $('#id').on('touchstart',function(e) { var _touch = e.originalEvent.targetTouches[0]; var ...

随机推荐

  1. ArcGIS紧凑型切片读取与应用1-解析(附源码)

    1.前言 ArcGIS 发布的切片服务分为紧凑型切片和传统的分散型切片以及最新ArcGIS por新增的矢量切片.传统的分散型切片面临的问题是文件个数太多,部署拷贝过程十分的耗时,紧凑型切片是对分散型 ...

  2. 牛刀小试MySQL--innodb_flush_log_at_trx_commit小结

    参数名:innodb_flush_log_at_trx_commit 参数值: 0 事务提交的时候,不会去刷日志缓存区,也不会立马写入至日志文件中.这种设置最危险.如果数据库挂了且运气不好,数据库的最 ...

  3. pip更新到18版本后使用pycharm更新问题:module 'pip' has no attribute 'main'

    今天升级pip到18.0版本后更新模块时出现错误 分析报错信息可知,问题出在packaging_tool.py文件的213行和109行,找到具体的代码,如下 # 109行函数 def do_insta ...

  4. LINQ 【增、删、改、查】数据绑定

    LINQ,语言集成查询(Language Integrated Query) 是一组用于c#和Visual Basic语言的扩展.它允许编写C#或者Visual Basic代码以查询数据库相同的方式操 ...

  5. Linux免密码登录设置

    Linux免密码登录设置 假设要登录的机器为192.168.1.100,当前登录的机器为192.168.1.101. 首先在101的机器上生成密钥(如果已经生成可以跳过): $ ssh-keygen ...

  6. iomanip的作用 C++

    c++程序里面经常见到下面的头文件 #include <iomanip> 这里面iomanip的作用比较多: 主要是对cin,cout之类的一些操纵运算子,比如setfill,setw,s ...

  7. 微信公共号:CTO技术总监

    业务价值胜过技术策略: 战略目标胜过具体项目的效益: 内置的互操作胜过定制的集成: 共享服务胜过特定目标的实现: 灵活性胜过优化: 不断演进地提炼胜过在最开始追求完美!

  8. java中int和Integer比较大小

    Integer是int的封装对象,两个对象==比较的是栈的值 Integer a = new Integer(1); Integer b = new Integer(1); a与b存的是Integer ...

  9. HDU6201

    transaction transaction transaction Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 132768/1 ...

  10. js-QuickStart-base.js

    // 1.变量(Variables) var myVariable; myVariable = 'Bob'; // 数据类型 string number boolean array object // ...