Start or stop LayerSlider on Shadowbox modal open or close

1.4k views Asked by At

I have a couple button in LayerSlider slides that open shadowbox modal windows when clicked. Right now, with the modal open, LayerSlider still animates in the background. This is being used within a WordPress theme that has both plugins pre-loaded. I've tried using the the stop function from the documentation but it doesn't seem to work:

$('#slider').layerSlider('stop');

Here is what I'm trying to test it with:

$('#layerslider_10 a.button').click(function() {
        $('#layerslider_10').layerSlider('stop');
    });

If I change stop to start and I click on the button it advances the slide, so the start function appears to work. Any reason why the stop function wouldn't work?

1

There are 1 answers

0
Sam On

I came across the same problem, with .layerslider('stop') not working, so searched the plugin's comments page on codecanyon: http://codecanyon.net/item/layerslider-responsive-jquery-slider-plugin/922100/comments?filter=all&term=lsdata.g.paused+%3D+false%3B&utf8=%E2%9C%93 - see top comment (at time of writing).

I'm using fancybox, but the principle should be the same - you need to disable the pauseOnHover option as this was starting it back up.

$('#layerslider-container-fw a.fancybox-media').click(function(e) {
    var data = $('#layerslider-container-fw').layerSlider('data');
    //turn off the pauseonhover init setting
    data.paused = false;
    $('#layerslider-container-fw').layerSlider('stop');
});

Hope this helps!