fix bugs
This commit is contained in:
parent
357ec2f703
commit
f321d68801
|
@ -100,8 +100,9 @@ class AdBannersController < ApplicationController
|
||||||
>
|
>
|
||||||
<div style=\"padding-bottom: 56.25%;position: relative;height: 0;\">
|
<div style=\"padding-bottom: 56.25%;position: relative;height: 0;\">
|
||||||
<iframe height=\"100%\" width=\"100%\"
|
<iframe height=\"100%\" width=\"100%\"
|
||||||
src=\"#{youtube_url}\" title=\"youtube\"
|
src=\"#{youtube_url}?enablejsapi=1\" title=\"youtube\"
|
||||||
style=\"position: absolute;\">
|
style=\"position: absolute;\"
|
||||||
|
data-yt-api-binded=\"0\" allowfullscreen>
|
||||||
</iframe>
|
</iframe>
|
||||||
</div>
|
</div>
|
||||||
<div class='w-ad-banner__caption_text'>#{ad_b.title}</div>
|
<div class='w-ad-banner__caption_text'>#{ad_b.title}</div>
|
||||||
|
|
|
@ -68,15 +68,21 @@ if (typeof onYouTubeIframeAPIReady !== 'function'){
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPlayerStateChange(event){
|
function onPlayerStateChange(event){
|
||||||
var iframe = $(event.target.getIframe()),
|
var iframe = $(event.target.h),
|
||||||
cyclediv = iframe.parents("div.cycle-slideshow");
|
cyclediv = iframe.parents("div.cycle-slideshow");
|
||||||
|
var widget = cyclediv.parents('.ba-banner-widget-youtube')
|
||||||
if(event.data == YT.PlayerState.PLAYING || event.data == YT.PlayerState.BUFFERING){
|
if(event.data == YT.PlayerState.PLAYING || event.data == YT.PlayerState.BUFFERING){
|
||||||
cyclediv.cycle("pause");
|
cyclediv.cycle("pause");
|
||||||
|
widget.find('.banner-pager,.controlplay,.button-mid,.ad-overlay').css('visibility','hidden')
|
||||||
}else if(event.data == YT.PlayerState.PAUSED || event.data == YT.PlayerState.ENDED){
|
}else if(event.data == YT.PlayerState.PAUSED || event.data == YT.PlayerState.ENDED){
|
||||||
cyclediv.cycle("resume");
|
cyclediv.cycle("resume");
|
||||||
|
widget.find('.banner-pager,.controlplay,.button-mid,.ad-overlay').css('visibility','')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
window.onYouTubePlayerAPIReady = function() {
|
||||||
|
onYouTubeIframeAPIReady();
|
||||||
|
};
|
||||||
$('.pause-slide').off('click').click(function(){
|
$('.pause-slide').off('click').click(function(){
|
||||||
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('pause');
|
$(this).parent("ul").parent('.w-ba-banner').find(".cycle-slideshow").cycle('pause');
|
||||||
$(this).addClass('active')
|
$(this).addClass('active')
|
||||||
|
|
Loading…
Reference in New Issue