Hi,


Joshp wrote:
> 
> I have searched and haven't quite come up with an answer.  I'm trying to
> load 2 separate carousels on the same page from different .txt file
> sources.  I'm not sure what I need to change.  I tried putting two
> separate Javascript jcarousel code on the same page and just changed the
> jQuery.get("../slideshow.txt", function(data) and additionally changed the
> jQuery("#mycarousel2").jcarousel.  However only one source shows up in
> both carousels.
> 
> Any help would be greatly appreciated.
> 

you need a callback function for each carousel since they load different
files. You can try that (untested):

function mycarousel_itemLoadCallback(url, carousel, state)
{
    // Since we get all URLs in one file, we simply add all items
    // at once and set the size accordingly.
    if (state != 'init')
        return;

    jQuery.get(url, function(data) {
        mycarousel_itemAddCallback(carousel, carousel.first, carousel.last,
data);
    });
};

And then pass the following anonymous function as parameter:

jQuery('#mycarousel').jcarousel({
    itemLoadCallback: function (carousel, state) {
mycarousel_itemLoadCallback('../slideshow1.txt', carousel, state); }
});

and for the second carousel:

jQuery('#mycarousel').jcarousel({
    itemLoadCallback: function (carousel, state) {
mycarousel_itemLoadCallback('../slideshow2.txt', carousel, state); }
});

Jan

-- 
View this message in context: 
http://www.nabble.com/Dynamic-Load-Ajax-of-2-jcarousel-same-page-tf4202780.html#a11961838
Sent from the jCarousel mailing list archive at Nabble.com.

Reply via email to