[jQuery] jCarousel add function
Greetings,
I'm trying out jCarousel. It's pretty cool; definitely visually
appealing! I was able to get a basic carousel (items are created by
static html) implemented with out problems. I then moved on, trying to
use the 'add' method provided by the library so that I would
eventually be able to add items with an external php script. However,
I can't seem to get the 'add' method working. Here's a code snippet:
<script type="text/javascript">
$(document).ready(function() {
$('#carousel').jcarousel({
itemLoadCallback: itemLoadCallbackFunction
});
});
</script>
<script type="text/javascript">
function itemLoadCallbackFunction(carousel, state)
{
else if (state == 'next') {
var i = carousel.size()+1;
var new_item = '<img src=\"'+'http:/static.flickr.com/
57/199481087_33ae73a8de_s.jpg'+'\" />';
carousel.add(i, new_item);
alert(carousel.size());
}
};
</script>
What I thought this should do is append an item (<img src="http:/
static.flickr.com/57/199481087_33ae73a8de_s.jpg" />) to the end of the
carousel and then alert me with the new size whenever I press the next
button. All it does though is alert me with the size that it was
before pressing the button.
I even tried adding an alert statement inside of the librarie's 'add'
method, but it never gets triggered.
Any ideas/suggestions? They would be appreciated!
Thanks,
Steve