|
|
|
|
@ -24,27 +24,28 @@ function getVideoPopup($videoEl){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$(document).ready(function () { |
|
|
|
|
$('.js-video').each(async function (){ |
|
|
|
|
$('.js-video').each(function (){ |
|
|
|
|
const $iframe = $(this); |
|
|
|
|
if($iframe.data('isYoutube')){ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if($iframe.data('isVimeo')){ |
|
|
|
|
await loadScript('https://player.vimeo.com/api/player.js'); |
|
|
|
|
const player = new Vimeo.Player(this); |
|
|
|
|
player.on('pause', function(data) { |
|
|
|
|
if(data.percent == 1){ |
|
|
|
|
getVideoPopup($iframe).show().animate({opacity: 1}, 200); |
|
|
|
|
if (document.fullscreenElement){ |
|
|
|
|
document.exitFullscreen(); |
|
|
|
|
loadScript('https://player.vimeo.com/api/player.js').then(() => { |
|
|
|
|
const player = new Vimeo.Player(this); |
|
|
|
|
player.on('pause', function(data) { |
|
|
|
|
if(data.percent == 1){ |
|
|
|
|
getVideoPopup($iframe).show().animate({opacity: 1}, 200); |
|
|
|
|
if (document.fullscreenElement){ |
|
|
|
|
document.exitFullscreen(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
player.on('play', function() { |
|
|
|
|
const $p = getVideoPopup($iframe); |
|
|
|
|
if($p.is(':visible')){ |
|
|
|
|
$p.animate({opacity: 0}, 800).then(() => {$p.hide();}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
player.on('play', function() { |
|
|
|
|
const $p = getVideoPopup($iframe); |
|
|
|
|
if($p.is(':visible')){ |
|
|
|
|
$p.animate({opacity: 0}, 800).then(() => {$p.hide();}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|