JQuery在单击相应的链接时向左和向右设置相邻div的动画
我这里有一把小提琴,来自堆栈溢出上的一个早期线程,它从左到右为所有div设置动画: JavascriptJQuery在单击相应的链接时向左和向右设置相邻div的动画,jquery,jquery-animate,slide,direction,Jquery,Jquery Animate,Slide,Direction,我这里有一把小提琴,来自堆栈溢出上的一个早期线程,它从左到右为所有div设置动画: Javascript jQuery(function($) { $('a.panel').click(function() { var $target = $($(this).attr('href')), $other = $target.siblings('.active'); if (!$target.hasClass('active')) { $other
jQuery(function($) {
$('a.panel').click(function() {
var $target = $($(this).attr('href')),
$other = $target.siblings('.active');
if (!$target.hasClass('active')) {
$other.each(function(index, self) {
var $this = $(this);
$this.removeClass('active').animate({
left: $this.width()
}, 500);
});
$target.addClass('active').show().css({
left: -($target.width())
}).animate({
left: 0
}, 500);
}
});
}))
我想通过单击3个div各自的链接来设置3个div的动画,以便: