why does jQuery Cycle hit specific callbacks in the before and after array during buildOptions?

why does jQuery Cycle hit specific callbacks in the before and after array during buildOptions?

Mike Alsup:

Thanks for your work on jQuery Cycle.

I have a question about some of the code. I'm trying to build a carousel where partial images are displayed, so I'm digging into custom transitions, and before and after callbacks. The carousel is gonna be fine, but I found some code that I don't understand in the plugin.

In the transitions included in the plugin, before and after are arrays. Is it possible to stack a bunch of callbacks onto these options? Or does Cycle assume that the options may have 1 callback and the transition may add 1 more? In buildOptions , only one of the callbacks is called for each of these options and I don't understand why these specific ones are called.

   
      // fire artificial events
      var e0 = $slides[first];
      if (opts.before.length)
        opts.before[0].apply(e0, [e0, e0, opts, true]);
      if (opts.after.length > 1)
        opts.after[1].apply(e0, [e0, e0, opts, true]);
   

I did my best to find the origin of these lines, but it appears to be pre-github. They exist in the original commit to your repo.

Cheers,

benjamin / bangpound.