我最近一直在试用Transit JS缩略图上的动画。它不是必不可少的我使用转运js,这可能是一件好事,因为我无法找到一种方法来破坏我的div上的动画调用。
基本上我想尝试禁用移动设备的动画,因为移动设备没有悬停,所以将其留在那里毫无意义。但是通过文档,我似乎无法找到一种方法来阻止这个过程。
我的代码如下所示:
$(".spark_burst").css({ scale: 0 });
$("a.trigger").bind('mouseenter play', function() {
$(this).find(".spark_burst").transition({
opacity: 0.7, scale: 2,
duration: 400,
easing: 'in',
queue:false,
complete: function() { }
});
$(this).find(".targeting").transition({
y: 0,
x: 235,
easing: 'in',
queue:false,
duration: 200
});
}).bind('mouseleave reset', function() {
console.log("hover out");
$(this).find(".spark_burst").transition({
opacity: 0, scale: 0,
duration: 400,
easing: 'out',
queue:false,
complete: function() { }
});
$(this).find(".targeting").transition({
y: 0,
x: 0,
easing: 'snap',
queue:false,
duration: 200
});
});
我试图解开这样的事件:
$(window).resize(function(){
if ($("#all_spark").css("marginRight") == "0px" ){
console.log("0 pixels");
$("a.trigger").unbind( "mouseover mouseout play reset" );
}
});
我的思维过程设置了一个调整大小功能,以便在父级触发移动样式时进行监视,然后取消绑定mouseover
和mouseout
触发器。但这是在黑暗中拍摄并且不起作用所以我猜这对我来说是纯粹的垃圾。
有什么想法吗?
答案 0 :(得分:0)
因此,您将mouseenter
和mouseleave
事件绑定到触发器
并取消绑定mouseover
和mouseout
事件,但它不起作用.....
...
但等待!!!他们是完全不同的事件!
mouseenter 与 mouseover 不同,
和
mouseleave 与 mouseout 不同,
到unbind一个事件,您需要使用相同的事件名称:)
在此演示中使用此转接JS进行测试:http://jsfiddle.net/JuKqK/
希望它有所帮助。