Vimeo spielt immer noch nach froogaloop api entladen - zub-foundation, vimeo, reveal.js, froogaloop

Ich veranstalte mehrere vimeo Videos in einer Galerie, indem ich Foundation 4 Framework mit Reveal modal als Lightbox-Effekt nutze. Leider spielen die Videos weiter, nachdem jedes Modal geschlossen wurde.

Ich bin noch neu in Jquery, also habe ich Froogaloop api (https://developer.vimeo.com/player/js-api) jedes Vimeo-Video zu entladen, aber ich kann es nicht zur Arbeit bringen.

Hier ist mein Code:

        //Vimeo Froogaloop API event handler
function ready(player_id) {
var player = $f(player_id),

play = document.getElementById("play"),
pause = document.getElementById("pause"),
unload = document.getElementById("unload");

play.addEventListener("click", function() {
player.api("play");
});

pause.addEventListener("click", function() {
player.api("pause");
});

unload.addEventListener("click", function() {
player.api("unload");
});
}

window.addEventListener("load", function() {
//Attach the ready event to the iframe
$f(document.getElementById("player")).addEvent("ready", ready);
});

HTML:

        <!-- //Video Click Event -->
<div class="row">
<div class="large-12 columns">
<div id="myModal3" class="reveal-modal">
<iframe id="player1" src="http://player.vimeo.com/video/62831216?api=1" width="720" height="406" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
<a class="close-reveal-modal" id="unload" href="#">x</a>
</div>
</div>
</div>

<div class="row">
<div class="large-12 columns">
<p><img src="/images/http://placehold.it/250x100" class="logo"></p>
</div>
</div>



<div class="row">
<div class="large-12 columns">&nbsp;</div>
</div>

<div class="row">
<div class="large-12 columns">&nbsp;</div>
</div>



<!-- //Foundation 4 Accordion -->
<div class="row">
<div class="large-12 columns">
<div class="section-container accordion" data-section="accordion">


<section class="section">
<div class="row">
<div class="large-5 columns"><p class="title"><a href="#"><img src="/images/http://placehold.it/301x248"></a></p></div>
<div class="large-7 columns">
<p class="title"><a href="#">Name</a><br> Title</p>
<p class="quote">"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur ac tempus libero."</p>
</div>
</div>

<div class="row">
<div class="large-12 columns">&nbsp;</div>
</div>

<div class="content">
<div class="row">
<div class="large-12 columns">&nbsp;</div>
</div>

<div class="row">
<div class="large-12 columns">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus malesuada sapien ut nibh porttitor fringilla in sit amet risus. Curabitur euismod viverra elit sed pretium. Suspendisse laoreet tristique convallis. Aliquam erat volutpat. Morbi pharetra lobortis purus non elementum. Pellentesque mattis dignissim lectus in blandit. Duis facilisis vestibulum adipiscing. Suspendisse vulputate viverra consequat. In quis lorem ut tellus fringilla egestas. Etiam semper, dolor ut luctus dapibus, leo nunc scelerisque erat, eget aliquam dolor mauris ut risus. Nam non sem non libero laoreet bibendum quis in mi. Sed non nibh risus. Nunc id nunc felis. Maecenas eu est dui. In tortor justo, facilisis vel pulvinar a, bibendum vel tellus.</p>
</div>
</div>

<div class="row">
<div class="large-12 columns">&nbsp;</div>
</div>

<div class="row">
<div class="large-12 columns">&nbsp;</div>
</div>

<div class="row">
<div class="large-12 columns">
<a href="#" data-reveal-id="myModal3" data-animation="fadeAndPop" data-animationspeed="300" data-closeonbackgroundclick="true" data-dismissmodalclass="close-reveal-modal">
<img src="/images/http://placehold.it/720x406">
</a>

<div class="row">
<div class="large-12 columns">&nbsp;</div>
</div>

<div class="row">
<div class="large-12 columns">
<p class="subheader"><b>Client</b><br>
<medium>"Title"</medium><br>
<small>Location</small></p>
</div>
</div>
</div>
</div>

<div class="row">
<div class="large-12 columns">&nbsp;</div>
</div>

<div class="row">
<div class="large-12 columns">&nbsp;</div>
</div>

</div>
</section>

</div>
</div>
</div>

Antworten:

0 für die Antwort № 1

Versuche dies zu benutzen

 <script type="text/javascript">
jQuery(document).ready(function($) {
$("body").live("click",function(){
if($("div.reveal-modal-bg").is(":visible")){
var resourceVideo = $("#myModal iframe").attr("src");
$("#myModal iframe").attr("src","").attr("src",resourceVideo);
};
})
});
</script>

Verwandte Fragen