jQuery动画扩展细节问题



好的,所以我仍在努力掌握jQuery的窍门。

我快搞定了!我需要关闭按钮开始关闭,但因为它在同一个容器中,它也会启动其他动画。有什么建议吗?

这是迄今为止我的代码的jsfiddle链接http://jsfiddle.net/w39Bb/5/

$('.outer-shell').click( function () {
    $(this).animate({
        height: '580px'
    }, 750).addClass('selected');
    $(this).find('.inner-shell').animate({
        height: '550px'
    }, 750);
    $(this).find('.details-click').animate({
        width: "0"
    }, 400).hide(100);
    $(this).find('.image-left-small , .image-right-small').animate({
        opacity: 0
    }).hide(400);
    $(this).find('.image-left-large, .image-right-large').animate({
        opacity: 1
    }).show(0);
    $(this).find('.close').animate({
        opacity: 1
    }, 1000).show();
});
$('h1.close').click(function () {
    $('.outer-shell').animate({
        height: '235px'
    }, 200).removeClass('selected');
    $('.inner-shell').animate({
        height: '229px'
    }, 200);
    $('.details-click').animate({
        width: '299px'
    }, 100).show();
    $('.image-left-small , .image-right-small').animate({
        opacity: 1
    }, 100).show();
    $('.image-left-large, .image-right-large').animate({
        opacity: 0
    }, 400).hide();
});
$('.outer-shell').hover( function () {
  $(this).toggleClass('hover');
});

不确定这是否是您想要实现的目标,但是。。添加stopPropagation?

$('h1.close').click(function (e) {
    e.stopPropagation();
    // The rest is the same :)

http://jsfiddle.net/w39Bb/6/

如果您使用$('#div-to-hide').hide() 隐藏不想要的另一个div,它对您有用吗

最新更新