auto center video

This commit is contained in:
chiu 2021-08-31 14:15:12 +08:00
parent 03de224748
commit 0a7fa677ad
1 changed files with 13 additions and 0 deletions

View File

@ -176,6 +176,18 @@
$(this).parents('.jp-video').eq(0).removeClass('hide-ui'); $(this).parents('.jp-video').eq(0).removeClass('hide-ui');
<% end %> <% end %>
} }
function jplayer_center_video_front(ele){
$(ele).css('margin-left',($(ele).parent().width()-$(ele).width())/2);
if($(ele).parents('.w-ba-banner').length>0){
$(ele).css('margin-top',($(ele).parents('.w-ba-banner').eq(-1).height()-$(ele).height())/2);
}
$(ele).css('transform','unset');
}
$(window).resize(function() {
$('.w-ba-banner video[id^=jp_video_]').each(function(){
jplayer_center_video_front(this);
});
})
if (typeof(default_video_data)=='undefined'){ if (typeof(default_video_data)=='undefined'){
var default_video_data = { var default_video_data = {
ready: function () { ready: function () {
@ -190,6 +202,7 @@
play: function() { // To avoid multiple jPlayers playing together. play: function() { // To avoid multiple jPlayers playing together.
play_<%= i %>_flag = true; play_<%= i %>_flag = true;
ad_call_on_play_jplayer_<%= i %>(this); ad_call_on_play_jplayer_<%= i %>(this);
jplayer_center_video_front(this);
}, },
click: function(){ click: function(){
click_jplayer_<%= i %>(); click_jplayer_<%= i %>();