【问题标题】:jQuery mobile: clientX and clientY and the taphold eventjQuery mobile:clientX 和 clientY 以及 taphold 事件
【发布时间】:2013-02-20 13:20:54
【问题描述】:

我在我的项目中使用了 taphold 事件,需要用户点击的点的坐标。不幸的是,event.clientX 和 event.clientY 是未定义的(cp。我的例子here)。 是否有可能获得类似于 onclick-event 的这些坐标?

提前致谢!

【问题讨论】:

    标签: javascript jquery jquery-mobile


    【解决方案1】:

    你需要作弊,我为你做了一个工作示例:http://jsfiddle.net/Gajotres/STLWn/

    $(document).on('vmousedown', function(event){
        holdCords.holdX = event.pageX;
        holdCords.holdY = event.pageY;
    });
    
    $(document).on('taphold', function(e){
        alert('X: ' + holdCords.holdX + ' Y: ' + holdCords.holdY ); 
    });
    
    var holdCords = {
        holdX : 0,
        holdY : 0
    }
    

    在桌面 Firefox、Android 4.1.1 Chrome 和 iPad 6.0 上测试

    【讨论】:

      猜你喜欢
      • 2013-06-14
      • 1970-01-01
      • 2012-03-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多