Project:Mouse Wheel
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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

#1

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

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

<?php
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.

#2

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?

#3

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

#4

There's no need to place that mousewheel_add code within ?

#5

Think this could go into core jCarousel module?

#6

Subscribing.

#7

Project:jCarousel» Mouse Wheel
Version:6.x-1.x-dev» 6.x-1.x-dev
Category:support request» feature request

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).