This is what i have in my code
function mycarousel_itemLoadCallback(carousel, state){ var classification = $('#award-type-filter').val(); $.get( '/classification/' + classification, function(xml) { mycarousel_itemAddCallback(carousel, carousel.first, carousel.last, xml); }, 'xml' ); };
function mycarousel_itemAddCallback(carousel, first, last, xml){ carousel.size(parseInt(jQuery('total', xml).text())); $('image', xml).each(function(i) { carousel.add(first + i, mycarousel_getItemHTML(jQuery(this).text())); }); };
function mycarousel_getItemHTML(url){ return '<img src="' + url + '" width="75" height="75" alt="' + url + '" />'; };
Drupal.behaviors.cupcake_profile = function (context) {
// Initialize jcarousel var carousel = $("#profile-carousel").jcarousel({ itemLoadCallback: mycarousel_itemLoadCallback, vertical: true }) $("#award-type-filter").change(function(){ var carousel = $('#profile-carousel').data('jcarousel'); carousel.reset(); var xml = $.get('/classification/' + $(this).val(), function(){ $.each(xml, function(i, item){ carousel.add(i+1, item); }); carousel.reload(); carousel.scroll(carousel.first); });
});
}
So, the $.get() function is called twice, when the page load first time, and when the select change it call carousel.reload, and this reload not are calling the mycarousel_itemLoadCallback again??? The item list are changed, but why the prev and next not working?? Why, when click prev, the item list is reloaded?
Thks in advanced!