【问题标题】:jQuery touch events to emulate mouse events when on mobile device在移动设备上模拟鼠标事件的 jQuery 触摸事件
【发布时间】:2012-11-17 18:06:22
【问题描述】:

我有一个区域图,当用户将鼠标移到/移出不同的地图区域项目时,我会在区域图图像旁边显示/隐藏一个图像。我还捕获了对地图区域项目的点击并执行了一些功能。现在,我想在没有鼠标(即手指)的设备上为用户提供这项工作。

鼠标悬停/移出/点击的代码是:

$('area[id^="maparea"]').mouseover(function () {
    // show image associated with this map area item
});
$('area[id^="maparea"]').mouseout(function () {
// hide image associated with this map area item
});
$('area[id^="maparea"]').click(function () {
    // select the image associated with the map area item
});

我怎样才能拥有与触摸事件类似的功能?

点击事件应该继续按原样工作。当您在我感兴趣的区域地图上移动手指(不抬起手指)时,图像会发生动态变化。

提前致谢。

【问题讨论】:

    标签: jquery touch


    【解决方案1】:

    【讨论】:

    • 谢谢@sdespont。在触摸移动事件中,返回当前手指位置的X、Y。如何将其转换为 (1) 是区域图图像上的手指和 (2) 哪个区域图项对应于 X、Y 坐标?
    猜你喜欢
    • 2019-05-01
    • 2015-11-01
    • 2020-12-09
    • 2021-02-10
    • 2019-04-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多