Closed scruffian closed 12 years ago
I wrote an extension to the carousel a while ago to add this functionality so scrolling the carousel with the mousewheel would update the internal state and consequentially update the UI.
I'll dig it out and clean it up when I get a chance and hopefully that'll be what you're looking for.
that sounds perfect. i am using this carousel alongside jcarousel lite at the moment because sometimes we need the mousewheel, so to just use yours will be a great help!
I just took a look at jCarousel lite's mousewheel demo and it turns out the extension I wrote a while ago isn't the same kind of thing as it doesn't 'snap' to each page, it just scrolls like a standard overflow: scroll div but updates the internal state and UI.
If you just want the snap to behavior then I'd try something like this:
$('#rs-carousel').carousel({
create: function () {
var el = $(this),
runner = el.find('.rs-carousel-runner'),
mask = el.find('.rs-carousel-mask'),
method;
mask.mousewheel(function (e, delta) {
e.preventDefault();
method = delta > 0 ? 'prev' : 'next'
if (!runner.is(':animated')) {
el.carousel(method);
}
});
}
});
Thanks! I'll give it a go when I get a chance and let you know how i get on...
I have a ui-touchCarousel version and could not get the mousewheel to work, is there another syntax that works for the touch extension?
I just tested and the above code works okay with the touch extension. Are you sure you're using the latest version of the carousel 1.0.1 and including the mousewheel plugin
I was using the scripts you have in this demo http://www.richardscarrott.co.uk/assets/javascript/jquery/ui-carousel-touch/demo.html
I updated to ui.carousel v1.0.1 and it seems works, just need to test in all browser/iOS to be sure.
Yeah I need to take that link down as it was an early experiment that was never actually released, the latest version offers up all the touch functionality and is better tested.
It would be great to add mouse wheel integration into this. If no one else has the opportunity I'll try and get to it, but it will take a while!