samedi 4 février 2017

YouTube and Fancybox 2

I am able to embed and view my YouTube videos in my website. The problem is: when MY videos finish, a YouTube screen appears with a number of OTHER PEOPLE'S videos as choices. I want the Fancybox pop-up to close when my video finishes so this doesn't happen. I have found a number of suggestions for closing the Fancybox pop-up when a YouTube video ends, but none of them work. I wonder if that's because they're written for Fancybox-1 and I'm using Fancybox-2. I've inserted the code below, but it doesn't trigger.

    <script>
    function onPlayerStateChange(event){
        if (event.data===0){
            $.fancybox.close();
        }
    }
</script>




Aucun commentaire:

Enregistrer un commentaire