jCarousel with Mousewheel Plugin
spiffyd - September 24, 2008 - 05:48
| Project: | jCarousel |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
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
});
?>
#1
Using the Mouse Wheel module, it's something like this:
<?phpmousewheel_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...
<?phpmousewheel_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.