0

ディスコグラフィーページをクリックする代わりに、「li img」がロードされたときに、このjcarouselがリンクを開くようにしたいだけです。私はjQueryを学ぶデザイナーです。気楽にお願いします。それが私の最初の質問です。:)

$(function () {
    /**
     * build the carousel for the Albums
     */
    $('#mp_albums').jcarousel({
        scroll: 1,
        wrap: 'both',
    }).children('li').bind('click', function () {
        //when clicking on an Album, display its info, and hide the current one
        var $this = $(this);
        $('#mp_content_wrapper').find('.mp_content:visible').hide();

        $('#mp_content_wrapper').find('.mp_content:nth-child(' + parseInt($this.index() + 1) + ')').fadeIn(1000);

    });

});

前もって感謝します。

4

1 に答える 1

0

適切なコールバックを見つけるためのリファレンスとして、この jCarousel ページを使用しました。itemVisibleInCallback が必要なようです。これで始められるはずです。問題や質問がある場合はお知らせください。回答を編集できます。

$(function () {
    /**
     * build the carousel for the Albums
     */
    $('#mp_albums').jcarousel({
        scroll: 1,
        wrap: 'both',
        itemVisibleInCallback: {
            onAfterAnimation: openInfo
        }
    });

    function openInfo(carousel, item, idx, state){
        //when clicking on an Album, display its info, and hide the current one
        var $this = $(item);
        $('#mp_content_wrapper').find('.mp_content:visible').hide();

        $('#mp_content_wrapper').find('.mp_content:nth-child(' +    parseInt($this.index() + 1) + ')').fadeIn(1000);
    }
});
于 2012-05-08T18:39:03.440 に答える