0

私はjavascriptやjqueryのスキルがありません。だから私はできる限りこれを理解しようとしました。

現在jQuery 1.9.1を使用しています。

私がやろうとしているのは、一番上の画像がクリックされたときに画像の山をアンパックまたはアンスタックすることです(もちろん、もう一度クリックすると再パックする必要があります)...

画像は、css :nth-child()... を使用して、画像のように配置されます。

jQueryでの私の試みは次のとおりです。

    $(document).ready(function(){

        var $profile = $('.profile');
        $profile.click(function(){

            $(this).toggleClass("active");
            $(".thumb").children().eq(1).animate({left:'150px'});
            $(".thumb").children().eq(2).animate({left:'150px'});
            $(".thumb").children().eq(3).animate({left:'150px'});
            $(".thumb").children().eq(4).animate({left:'150px'});
            $(".thumb").children().eq(5).animate({left:'150px'});
            $(".thumb").children().eq(6).animate({left:'150px'});
            $(".thumb").children().eq(7).animate({left:'150px'});
            $(".thumb").children().eq(8).animate({left:'150px'});
            $(this).siblings(".user-info").toggleClass("active");       

        });
    });

私はこのタスクを達成するために jquery をほとんど学ぶために 3 日間試みました。

これがどのように見えるかです

これは、よりよく説明するための画像です

4

1 に答える 1