0
演示http://www.bootply.com/gyEJYEzFeijQuery的动画缺陷
显然,动画()非异步使他们不能在同一时间触发的,但我不知道为什么当鼠标离开是有重叠的问题,在底排。我尝试过渡与CSS,现在与动画()仍然无法完善动画。代码
$('.hoverExpand').mouseenter(function() {
var $this = $(this);
var getIndexOfTarget = $this.closest('.product-panel').index();
if(getIndexOfTarget % 2 == 0){ //check target if is even
$('.product-panel').filter(function(i) {
return i > 2 && i % 2 == 1
}).animate({'margin-top':"-=100px",
"transition":"all 0.2s linear"
});
}else{
$('.product-panel').filter(function(i) {
return i > 1 && i % 2 == 0;
}).animate({'margin-top':"-=100px",
"transition":"all 0.2s linear"
});
}
if (!$this.hasClass('on')) {
$this.addClass('on');
$this.find('.productsThumbWrap').stop(true, true).animate({
"margin-top": "200px"
}, "fast",function(){
});
$this.find('.productsThumbWrap img').stop(true, true).css({
opacity: 1,
'transition': 'opacity 0.45s ease 0.15s'
});
}
});
'transition'属性不可动画。将它设置在你的CSS中,或者在链中的某处使用'.css({transition:“all 0.2s linear”})“。 – 2014-10-02 09:30:38