0

I just want this jcarousel to open the links when "li img" is loaded instead of clicked on a discography page. I'm a designer learning jQuery. Go easy with me, please. That's my first question. :)

$(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);

    });

});

Thanks in advance.

aarede
  • 3
  • 1
  • Not very clear what you are looking for here. What are the "links"? What do you mean by "instead of clicked on a discography page"? Can you provide what the html looks like for the carousel? More info please! – lbstr May 08 '12 at 17:40
  • I have a page with a discography, and jCarousel loads a div when a thumb is clicked. But I want the div that corresponds to album opens when your thumb is loaded instead of clicked. [link](http://www.gangrenagasosa.com.br/4.0/15.playlists/index_fade.html) – aarede May 08 '12 at 18:13

1 Answers1

0

I used this jCarousel page as a reference for finding the appropriate callback. It looks like you want itemVisibleInCallback. This should get you started. Let me know if you have any problems/questions and we can edit my answer.

$(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);
    }
});
lbstr
  • 2,822
  • 18
  • 29
  • Completely asked and solved. I hope to find some topic that I can help another one like you did to me. Thank you very, very much!!! – aarede May 08 '12 at 18:49