0

さて、私はまだ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');
});
4

2 に答える 2

1

それがあなたが達成しようとしているものかどうかはわかりませんが、.. stopPropagation を追加しますか?

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

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

于 2013-04-10T20:19:46.623 に答える
0

使用したくない他のdivを非表示にするとうまくいきますか$('#div-to-hide').hide()

于 2013-04-10T13:41:59.903 に答える