Does anyone know how to configure the jcarousel to allow for scrolling with the mousewheel plugin?
I'm trying to figure out what belongs to NEXTFUNCTION and PREVIOUSFUNCTION...

<?php
	$(document).ready(function() {	
		 jCarousel mousewheel scrolling
		$('#DIV')
			.mousewheel(function(event, delta) {
				if (delta > 0)
					$('.jcarousel-next-vertical').NEXTFUNCTION;
				else if (delta < 0)
					$('.jcarousel-prev-vertical').PREVIOUSFUNCTION;
				return false; // prevent default
		});
?>

Comments

robloach’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev

Using the Mouse Wheel module, it's something like this:

mousewheel_add('#jcarousel', 'CarouselMouseWheel');

.... And then in your custom JavaScript, you would use:

/**
* Called when there is a mouse wheel event on the carousel.
*/
function CarouselMouseWheel(event, delta) {
  if (delta < 0) {
    $('#jcarousel').next();
  }
  else if (delta > 0) {
    $('#jcarousel').prev();
  }
  return false;
}

The MouseWheel module needs backport to 5.

spiffyd’s picture

Hi Rob, thanks for the documentation!

Hm... so for clarification, where do I place the code...

<?php
mousewheel_add('#jcarousel', 'CarouselMouseWheel');
?>

any where on my page.tpl.php? As a script or php insert?

robloach’s picture

In your page.tpl.php....... '#jcarousel' is the ID of the carousel on the page.

spiffyd’s picture

There's no need to place that mousewheel_add code within

?
robloach’s picture

Think this could go into core jCarousel module?

silurius’s picture

Subscribing.

quicksketch’s picture

Project: jCarousel » Mouse Wheel
Category: support » feature

Considering a total of 11 modules currently use the Mouse Wheel module, versus thousands using jCarousel, I think it would make more sense for Mouse Wheel to include support for jCarousel rather than the other way around (less popular modules generally provide support for the more popular ones).