попап в конце видео

remotes/origin/feature/end-video-popup-28-05-19
gzbender 7 years ago
parent e53e67cd3c
commit a9003418f5
  1. 31
      web/src/js/modules/content.js

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

Loading…
Cancel
Save