jQuery 触摸事件以模拟在移动设备上的鼠标事件



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

我有的鼠标悬停/出/单击的代码是:

$('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
});

如何对触摸事件具有类似的功能?

单击事件应继续按原样工作。 这是当您在区域地图周围移动手指(不抬起手指)时图像的动态变化,我对此感兴趣。

提前谢谢。

您需要使用特定的touch库,例如

http://danielglyde.blogspot.co.uk/2012/08/touchit-jquery-plugin-for-touch-events.html

最新更新