Great work Jeremy.  I am using jcarousel in horizontal alignment mode
and I needed a way to pause the auto scrolling when a user hovers over
an item; otherwise clicking on an item could be difficult as the item
could scroll away before having clicked on it.  Based on your code I
was able to do this with the code below:

    jQuery(document).ready(function() {
        jQuery('#mycarousel').jcarousel({
            scroll: 1,
            auto: 2,
            wrap: 'last',
            initCallback: function(jc, state) {
              if (state == 'init') {
                  /* Pause carousel scrolling when a user mouses overs
an item and restart the scrolling when they mouse out.
                   * Written by cormac at finisco dot com 19/2/2009
based on work by Jeremy Mikola:
                   * 
http://groups.google.com/group/jquery-en/browse_thread/thread/f550b94914d10065
                   */
                jc.startAutoOrig = jc.startAuto;
                jc.startAuto = function() {
                  if (!jc.paused) {
                    jc.startAutoOrig();
                  }
                }
                jc.pause = function() {
                  jc.paused = true;
                  jc.stopAuto();
                };
                jc.play = function() {
                  jc.paused = false;
                  jc.startAuto();
                };
                $('li.jcarousel-item').mouseover(function() {
                    jc.pause();
                });
                $('li.jcarousel-item').mouseout(function() {
                    jc.play();
                });
              }
              jc.play();
            }
        });
    });

Reply via email to