-1

I have been to a lot of answers but not one of it has answered my problem. I have this JCarousel, autoscroll. I want it to stop on hover, what do I need to add up in my code?

<script type="text/javascript">

jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        auto: 1,
        wrap: 'circular',
        vertical: true,
        animation: 3500,
        pauseOnHover: true,
        scroll:1,
    });
});
</script>

Thanks in advance guys!

Monica Negapatan
  • 251
  • 1
  • 14
  • 29

3 Answers3

1

Here are the steps for the resoudere promeble of how to make Pause on Mouse Hover working on JCarousel

step : 1 make this function in the root of our safe ( file.js) .

 function mycarousel_initCallback(carousel)
{
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

step 2: make this function in ready function

jQuery(document).ready(function() {

//exemple
 jQuery('#carosule ul').jcarousel({
     scroll:1,
     visible:4,
     wrap:"circular",
     animation:300,
     auto:1,
     hoverPause: true,
     width: 160,
     initCallback: mycarousel_initCallback

    });

});
Kamil Budziewski
  • 22,699
  • 14
  • 85
  • 105
0

Add this code in the your initialization: initCallback(carousel)

carousel.clip.hover(function() {
    carousel.stopAuto();
}, function() {
    carousel.startAuto();
});

This has been even mentioned in a bug in jCarousel.

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();
    });
};
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252
0

Updating the answer to stay current.

See https://github.com/jsor/jcarousel/issues/568 for the correct answer:

$('.jcarousel').hover(function() {
    $(this).jcarouselAutoscroll('stop');
}, function() {
    $(this).jcarouselAutoscroll('start');
});
emd
  • 434
  • 1
  • 7
  • 18