1

I'm using the following Modal window script: https://github.com/drublic/css-modal

I've found the code that triggers on the closing of the current modal window. I've added in some code from Vimeo's developers page slightly modified:

// Unfocus
modal.removeFocus = function () {
    if (modal.lastActive) {
        modal.lastActive.focus();
    }

    var iframe = jQuery(".big-image iframe")[0];
    var player = jQuery(iframe);

    //player=jQuery('.big-image iframe')[0];
    alert(player);
    player.api('pause');
};

I'm getting the following error on when a modal is closed with a video playing.

Uncaught TypeError: Object [object Object] has no method 'api'

This is a snippit of the iframe code. There could be multiple visible at one time.

<div class="big-image">
    <iframe src="http://player.vimeo.com/video/79541124?title=0&amp;byline=0&amp;color=ff0000" width="640" height="480" frameborder="0"></iframe>
</div>

I'm initially trying to find the first video and stop it on close. Ultimately, I would like to find the video(s) currently playing and stop it on Modal close.

Thoughts?

Dave Rottino
  • 1,037
  • 3
  • 22
  • 49

0 Answers0