diff --git a/app/views/admin/ad_images/_jplayer.html.erb b/app/views/admin/ad_images/_jplayer.html.erb index a1c0e95..c68495b 100644 --- a/app/views/admin/ad_images/_jplayer.html.erb +++ b/app/views/admin/ad_images/_jplayer.html.erb @@ -176,6 +176,18 @@ $(this).parents('.jp-video').eq(0).removeClass('hide-ui'); <% 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'){ var default_video_data = { ready: function () { @@ -190,6 +202,7 @@ play: function() { // To avoid multiple jPlayers playing together. play_<%= i %>_flag = true; ad_call_on_play_jplayer_<%= i %>(this); + jplayer_center_video_front(this); }, click: function(){ click_jplayer_<%= i %>();