Hi guys, is there a way to stop the auto scroll whenever we mouse over the jcarousel?

there's an example here, but where/how to place the javascript in the jcarousel module?
http://sorgalla.com/projects/jcarousel/examples/static_auto.html

sorry, noob here with very little progamming language :]
thanks!

CommentFileSizeAuthor
#6 jcarousel_pause_auto.patch3.1 KBquicksketch

Comments

hermes_costell’s picture

Unfortunately I could never get the module working - I just put the straight javascript into my header.

If you've successfully gotten the module working then:
1: in your config statement (where you set the scrolling speed, wrap, etc) put in "initCallback: mycarousel_initCallback" or initCallback="mycarousel_initCallback" or whatever, depending on how your code is constructed.
2: Get this javascript code here into your header somehow:

function mycarousel_initCallback(carousel)
{
   
    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

Does that make sense?

raimondious’s picture

Thanks for this!

As for getting it into the <head>, I put this into a file called carouselcallback.js and added it to the js directory of my theme. I enable jcarousel by calling jcarousel_add([my arguments]) in a preprocess function in my template.php, so I just added drupal_add_js('[path to my theme]/js/carouselcallback.js', 'theme'); in the same place — it works great.

quicksketch’s picture

Title: how to pause auto scroll when mouse over link » Pause auto scroll when mouse over link
Version: 6.x-1.1 » 6.x-2.x-dev
Category: support » feature
Priority: Critical » Normal

This sounds like a good feature to include directly in the module now that we include Views support. I think it'd make sense to have this be the default functionality for auto-scrolling carousels, with the option to turn it off is explicitly disabled.

vood002’s picture

I'm using 7.x 2.0-alpha 1

When I attempt to pass a function though initCallback i get the javascript error

this.options.initCallback is not a function
[Break On This Error] (function(i){var q={vertical:false,rtl...rousel", new h(this,a))})}})(jQuery); 

I'm not opening a new issue b/c I'm not convinced that this isn't just me screwing something up...it works fine without the initCallback option, here is how I'm setting it:

<?php

  $options = array(
    'scroll' => 3,
    'animation' => '8000',
    'wrap' => 'circular',
    'auto' => 10,
    'initCallback' => 'carousel_init_callback'
   ); 
   
   jcarousel_add('work-carousel', $options);

?>

Any idea if this is my method or a bug with jCarousel?

quicksketch’s picture

A new issue is probably appropriate for your question vood002. Your initCallback needs to be an actual function, not a string.

quicksketch’s picture

Title: Pause auto scroll when mouse over link » Pause auto-scroll when mouse over item
Version: 6.x-2.x-dev » 6.x-2.0
Status: Active » Fixed
StatusFileSize
new3.1 KB

I've committed this patch to add this functionality to our Views integration. You can also utilize it in custom coding applications by setting the "autoPause" option to 1, which will create an initCallback function for you, similar to hermes_costell's suggestion in #1.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

saikatbiswas82’s picture

Project: jCarousel » jCarousel Lite
Version: 6.x-2.0 » 5.x-1.0
Assigned: Unassigned » saikatbiswas82

This issue has been fixed. Please take a look here: http://code.google.com/p/jcarausel-lite-pause-on-hover-fixed/