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

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 () {
$('.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();});
}
});
});
}
});

Loading…
Cancel
Save