1
我正在寻找ios的解决方案,就像悬停在'桌面世界'中一样。 我的页面上有很多图片项目,当用户在图片上移动他的手指时,活动图片获得不透明度0.(所以一个动作隐藏了所有项目:))jquery touchstart在多个元素上
我试过类似这样的东西:
$("img").on "touchstart", ->
$(this).animate({opacity:0}, 100)
我正在寻找ios的解决方案,就像悬停在'桌面世界'中一样。 我的页面上有很多图片项目,当用户在图片上移动他的手指时,活动图片获得不透明度0.(所以一个动作隐藏了所有项目:))jquery touchstart在多个元素上
我试过类似这样的东西:
$("img").on "touchstart", ->
$(this).animate({opacity:0}, 100)
如果你想隐藏的所有图像,当一个recive的touchstart
-event你应该使用:
$("img").on("touchstart", function() {
$("img").animate({opacity:0}, 100);
});
甚至更好:
var $images = $("img").on("touchstart", function() {
$images.fadeTo(100, 0);
});
this
关键字指DOM元素接收事件评估者,然后是整个jQuery集合。
不适用于CoffeeScript。
$(document.body).on "touchmove", (event) ->
if $(event.target).is("img")
$(event.target).animate
opacity: 0
, 100
我只想隐藏手指指向的那个元素 – Dodjs 2013-03-05 13:01:27
@Dodjs你是否使用过'touchmove'进行了研究。也许用'event.target'? – andlrc 2013-03-05 13:06:50
是的,我尝试了两种,但只适用于第一项 – Dodjs 2013-03-05 13:39:37