Search code examples
jqueryfancyboxcyclejquery-cycle

Pause cycle all slideshow when fancybox opens


Trying to pause slideshow when fancybox is active, can't get it to work—any suggestions appreciated.

 $('.section-testimonials').cycle({
    fx: 'fade',
    speed: 1000,
    containerResize: 0,
    timeout: 9000,
    pager:      '#slide-nav', 
    pagerEvent: 'mouseover',
    pauseOnPagerHover: true ,
    pause: 1
});

$(".fancybox").fancybox({
    'overlayColor':'#E8EEF4',
    'overlayOpacity': .9,
    'onStart': function(){
        $('.section-testimonials').cycle('pause');
    },
    'onClosed': function(){
        $('.section-testimonials').cycle('resume');
    }
});

Solution

  • For one, you're missing a ; after your onClosed function code:

    $('.section-testimonials').cycle('resume')
    

    Also, try using window.parent.document:

    $(".fancybox").fancybox({
        'overlayColor':'#E8EEF4',
        'overlayOpacity': .9,
        'onStart': function(){
            $('.section-testimonials', window.parent.document).cycle('pause');
        },
        'onClosed': function(){
            $('.section-testimonials', window.parent.document).cycle('resume');
        }
    });