Feature/end video popup 28 05 19 See merge request lilschool/site!309remotes/origin/feature/buy-email-5-06-19
commit
24ab061c5e
17 changed files with 173 additions and 58 deletions
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 82 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 93 KiB |
@ -0,0 +1,52 @@ |
|||||||
|
import $ from 'jquery'; |
||||||
|
import {loadScript} from '../utils'; |
||||||
|
import {api} from '../modules/api'; |
||||||
|
|
||||||
|
function getVideoPopup($videoEl){ |
||||||
|
const $container = $videoEl.parent(); |
||||||
|
const courseId = $videoEl.data('courseId'); |
||||||
|
let $popup = $container.children('.video-ended-popup'); |
||||||
|
if(! $popup[0]){ |
||||||
|
$popup = $('<div class="video-ended-popup"><div class="video-ended-popup__like-btn"></div></div>'); |
||||||
|
if(courseId){ |
||||||
|
$popup.addClass('video-ended-popup_black'); |
||||||
|
/* |
||||||
|
$popup.find('.video-ended-popup__like-btn').click(() => { |
||||||
|
api.likeCourse(courseId).then(() => { |
||||||
|
$popup.addClass('video-ended-popup_black'); |
||||||
|
}); |
||||||
|
});*/ |
||||||
|
} |
||||||
|
|
||||||
|
$container.append($popup); |
||||||
|
} |
||||||
|
return $popup; |
||||||
|
} |
||||||
|
|
||||||
|
$(document).ready(function () { |
||||||
|
$('.js-video').each(function (){ |
||||||
|
const $iframe = $(this); |
||||||
|
if($iframe.data('isYoutube')){ |
||||||
|
|
||||||
|
} |
||||||
|
if($iframe.data('isVimeo')){ |
||||||
|
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();}); |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
@ -0,0 +1 @@ |
|||||||
|
import "../modules/content"; |
||||||
@ -0,0 +1 @@ |
|||||||
|
import "../modules/content"; |
||||||
Loading…
Reference in new issue