我正在尝试弄清楚如何使用touchmove事件在iOS上模拟悬停/鼠标输入功能。
我想在iOS上复制BigGraph悬停效果。如果你不熟悉它,链接在下面。请注意,当您将鼠标悬停在方块上时,它们将展开,然后在移除悬停时折叠。
http://isotope.metafizzy.co/custom-layout-modes/big-graph.html
在BigGraph中,你会注意到鼠标悬停在上面的行为,我正在尝试将其复制到一个触摸设备上。我正在努力想办法让你的手指在屏幕上移动,让盒子变得更大。由于不支持悬停,我认为触摸移动可能是一种选择。
我已经能够使用touchstart和touchend事件展开项目,但似乎touchmove无法捕获您悬停在其上的DIV,因此我无法捕获项目来展开它。
下面是一个简单的代码片段,如果您有任何想法,将不胜感激。thx
$(".item").bind("touchstart", function(e){
log("touch start");
$(e.currentTarget).find('.icon').css("background-color", "red");
e.preventDefault();
});
$(".item").bind("touchend", function(e){
log("touch end");
});
.big-graph .item:hover .icon {
-webkit-transform: scale(2);
-moz-transform: scale(3);
-ms-transform: scale(3);
-o-transform: scale(3);
transform: scale(3);
}发布于 2012-05-18 21:16:48
我不确定你想要用touchmove捕捉到什么。而是模拟盒子展开和折叠的悬停
$('.item').bind('touchstart', function() {
// expand box
});
$('.item').bind('touchend', function() {
// collapse
});我认为你根本不需要touchmove,除非我遗漏了什么。也许有一种行为是你想要的,但没有清楚地提到?
发布于 2012-05-30 03:12:29
我不是iOS程序员,但你能以某种方式使用多点触摸功能吗?例如,1指触摸是“点击”;2指触摸是“悬停”。或切换按钮(单击/悬停)。
https://stackoverflow.com/questions/10653209
复制相似问题