)我有这个代码在动画之间divs滑出。如果一个项目被点击,它的相关内容滑出如果另一个项目被点击,当前内容滑回和新内容滑出延迟动画,直到其他动画完成(滑动内容(
然而,
var lastClicked = null;
var animateClasses = ['ale', 'bramling', 'bullet', 'miami-weisse'];
for (var i=0; i<animateClasses.length; i++) {
(function(animCls) {
$('.each-brew.'+animCls).toggle(function() {
if (lastClicked && lastClicked != this) {
// animate it back
$(lastClicked).trigger('click');
}
lastClicked = this;
$('.each-brew-content.'+animCls).show().animate({ left: '0' }, 1000).css('position','inherit');
}, function() {
$('.each-brew-content.'+animCls)
.animate({ left: '-33.3333%' }, 1000, function() { $(this).hide()}) // hide the element in the animation on-complete callback
.css('position','relative');
});
})(animateClasses[i]); // self calling anonymous function
}
然而,内容滑出一旦已开放内容向后滑动过快滑出 - 它需要等到内容已经完全滑动回在它滑出之前这是可能的吗?
下面是我目前正在努力获得想法的链接(http://goo.gl/s8Tl6)。
干杯提前, [R
克里斯,这工作的一种享受。感谢您的解决方案 - 我会挖掘并确保我理解它。非常感谢。 – 2013-02-18 10:24:04