How to pause depending on item type

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to pause depending on item type

doug
Hi

My collections contain a mixture of images (JPG) and YouTube videos, in any order.

I want the images to autoplay using a slideshow, but when a YouTube video is encountered I want the slideshow to pause. I tried wiring up the onFinish event.

Shadowbox.init({
        skipSetup: true,
    slideshowDelay: 5,
    onFinish: function(item){if (item.player != 'img') Shadowbox.pause();}
});

But this doesn't appear to work. It looks like, internally, SB is executing a play() after the onFinish event has completed. I also tried setting slideshowDelay to zero in the onFinish event, but this didn't work either.

Any suggestions? Thanks in advance.

Doug
Reply | Threaded
Open this post in threaded view
|

Re: How to pause depending on item type

doug
I think I've worked it out already! I looked at some postings which describe how to start a slideshow paused, and they suggest calling play() before pause(). So, I changed my code to

Shadowbox.init({
    skipSetup: true,
    slideshowDelay: 5,
    onFinish: function(item){if (item.player != 'img'){Shadowbox.play(); Shadowbox.pause();}}
});

and this seems to have done the trick.

Doug