Skip to content

Commit

Permalink
Decoupled video player from Vimeo(vuejs#622)
Browse files Browse the repository at this point in the history
  • Loading branch information
vuejs-jp-bot authored and re-fort committed Jan 11, 2018
1 parent f848dc2 commit b128691
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion themes/vue/layout/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
</div>

<div id="video-modal" class="modal">
<div class="vimeo-space" style="padding: 56.25% 0 0 0; position: relative;"><iframe src="https://player.vimeo.com/video/247494684" style="height: 100%; left: 0; position: absolute; top: 0; width: 100%;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>
<div class="video-space" style="padding: 56.25% 0 0 0; position: relative;"><iframe src="https://player.vimeo.com/video/247494684" style="height: 100%; left: 0; position: absolute; top: 0; width: 100%;" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>
</div>

<script>
Expand Down
12 changes: 7 additions & 5 deletions themes/vue/source/js/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,16 +144,18 @@
* Modal Video Player
*/
function initVideoModal () {
if (typeof Vimeo === 'undefined') return

var modalButton = document.getElementById('modal-player')
var videoModal = document.getElementById('video-modal')
var iframe = document.querySelector('iframe');
var player = new Vimeo.Player(iframe);

if (!modalButton || !videoWrapper) {
return
}

var iframe = document.querySelector('iframe')
var player = new Vimeo.Player(iframe)
var overlay = document.createElement('div')
overlay.className = 'overlay'


modalButton.addEventListener('click', function(event) {
event.stopPropagation()
videoModal.classList.toggle('open')
Expand Down

0 comments on commit b128691

Please sign in to comment.