|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
Display 2 jcarousel loading from 2 different txt filesHi all!
I'd like to have 2 carousels loading content from 2 different files displayed on a single page, just like in the example "dynamic_ajax.html" (which loads dynamically the data from a simple text file which contains the image urls). The part with the 2 carousels is ok (found in the forum): jQuery(document).ready(function() { jQuery('#mycarousel1').jcarousel({ itemLoadCallback: mycarousel_itemLoadCallback }); jQuery('#mycarousel2').jcarousel({ itemLoadCallback2: mycarousel_itemLoadCallback }); }); But how do I make "mycarousel1" load "carousel-content1.txt" and "mycarousel2" load "carousel-content2.txt"?? Thanks A LOT for the answer! Regards, Max |
|
|
Re: Display 2 jcarousel loading from 2 different txt filesHi,
this has been answered here: http://www.nabble.com/Dynamic-Load-Ajax-of-2-jcarousel-same-page-tf4202780.html#a11961838 Jan |
|
|
Re: Display 2 jcarousel loading from 2 different txt filesThanks!
But it seems don't want to work: I have no more carousel on the page. Here is what I have now: <script type="text/javascript"> function mycarousel_itemLoadCallback(url, carousel, state) { if (state != 'init') return; jQuery.get(url, function(data) { mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, data); }); }; function mycarousel_itemAddCallback(carousel, first, last, data) { var items = data.split('|'); for (i = 0; i < items.length; i++) { carousel.add(i+1, mycarousel_getItemHTML(items[i])); } carousel.size(items.length); }; function mycarousel_getItemHTML(url) { return ' }; jQuery('#mycarousel1').jcarousel({ itemLoadCallback: function (carousel, state) { mycarousel_itemLoadCallback('carousel-content1.txt', carousel, state); } }); jQuery('#mycarousel2').jcarousel({ itemLoadCallback: function (carousel, state) { mycarousel_itemLoadCallback('carousel-content2.txt', carousel, state); } }); </script> Thanks for the help. Max
|
|
|
Re: Display 2 jcarousel loading from 2 different txt filesHi,
you have to put the carousel initialisation inside jQuery(document).ready() : jQuery(document).ready(function() { jQuery('#mycarousel1').jcarousel({ itemLoadCallback: function (carousel, state) { mycarousel_itemLoadCallback('carousel-content1.txt', carousel, state); } }); jQuery('#mycarousel2').jcarousel({ itemLoadCallback: function (carousel, state) { mycarousel_itemLoadCallback('carousel-content2.txt', carousel, state); } }); });
|
|
|
Re: Display 2 jcarousel loading from 2 different txt filesIt works well now!
Thanks a lot (really)! Cheers, Max
|
| Free embeddable forum powered by Nabble | Forum Help |