Search code examples
javascriptjquerycaroufredsel

Execute function on image change with carouFredSel


This seems to be pretty basic but i can't find anything on the topic, i tried looking the Advanced Documentation and here but nothing.

I need to execute a callback when the carousel changes the image to do some DOM manipulation. is there a way to do that?


Solution

  • You should try this:

    $(document).ready(function() {
    $("#caroufredsel-6").carouFredSel({
    responsive  : true,
    items       : 3,
    width: '100%',
    height: 'auto',
      scroll: {
            duration: 1000,
            timeoutDuration: 3000,
      onBefore : function( data ) {
           console.log("Transition");
           //alert("Transition");
      }
    }
    });
    
    });
    

    Working Fiddle: http://jsfiddle.net/robertrozas/PwCJb/