(function($){ $.fn.jcarousel_gall = function(callerSettings) { var basket_class = this; var find_gall = function(){ $(basket_class).each(function (i) { $(this).bind('click',function(){ var href = $(this).attr('href'); $.post(href, function(data) { $('#jcarousel').hide(); $('#jcarousel').html(data); $('#jcarousel').fadeIn('slow'); }); return false; }) }) } var start_gall = function(){ var href = $('.jcarousel_gall:first').attr('href'); $.post(href, function(data) { $('#jcarousel').hide(); $('#jcarousel').html(data); $('#jcarousel').fadeIn('slow'); }); } start_gall(); find_gall(); } })(jQuery);