JSFiddle - React, Tailwind, and code Playground
by ryanburnett
HTML
<script src="http://a.vimeocdn.com/js/froogaloop2.min.js"></script>
<script src="https://raw.github.com/zurb/foundation/master/js/foundation/foundation.reveal.js"></script>
<div id="myModal" class="reveal-modal">
<iframe id="myVideo" src="http://player.vimeo.com/video/42877261?api=1&player_id=myVideo" width="532" height="299" frameborder="0" webkitallowfullscreen="" mozallowfullscreen="" allowfullscreen=""></iframe>
<a class="close-reveal-modal">×</a>
</div>
CSS
/* CSS for jQuery Reveal Plugin
* Maintained for Foundation. foundation.zurb.com
* Free to use under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*/
/* Reveal Modals ---------------------- */
.reveal-modal-bg {
position: fixed;
height: 100%;
width: 100%;
background: #000;
background: rgba(0, 0, 0, 0.45);
z-index: 40;
display: none;
top: 0;
left: 0;
}
.reveal-modal {
background: white;
visibility: hidden;
display: none;
top: 100px;
left: 50%;
margin-left: -260px;
width: 520px;
position: absolute;
z-index: 41;
padding: 30px;
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
-moz-box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.4);
}
.reveal-modal *:first-child {
margin-top: 0;
}
.reveal-modal *:last-child {
margin-bottom: 0;
}
.reveal-modal .close-reveal-modal {
line-height: .5;
position: absolute;
top: 8px;
right: 11px;
color: #aaa;
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.6);
font-weight: bold;
cursor: pointer;
}
.reveal-modal.small {
width: 30%;
margin-left: -10%;
}
.reveal-modal.medium {
width: 40%;
margin-left: -20%;
}
.reveal-modal.large {
width: 60%;
margin-left: -30%;
}
.reveal-modal.xlarge {
width: 70%;
margin-left: -35%;
}
.reveal-modal.expand {
width: 90%;
margin-left: -45%;
}
.reveal-modal .row {
min-width: 0;
}
/* NOTES
Close button entity is ×
Example markup
<div id="myModal" class="reveal-modal">
<h2>Awesome. I have it.</h2>
<p class="lead">Your couch. I it's mine.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In ultrices aliquet placerat. Duis pulvinar orci et nisi euismod vitae tempus lorem consectetur. Duis at magna quis turpis mattis venenatis eget id diam. </p>
<a class="close-reveal-modal">×</a>
</div> */
JavaScript
$(function(){
// Included froogaloop api
// https://github.com/vimeo/player-api/tree/master/javascript
var $revealModal = $("#myModal"),
$myVideo = $("#myVideo")
vimeoPlayer = $f( $myVideo[ 0 ] )
;
// Bind to the reveal opening event
$revealModal.bind("reveal:open",function(){
// It's opening
$myVideo.show();
})
// Bind to the reveal closing event
.bind("reveal:close",function(){
// It's closing
$myVideo.hide();
vimeoPlayer.api( 'pause' );
})
// Fire reveal object.
.reveal();
});