From b764d2e4af39c8559916130f8c5f2dfd9993a069 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Mon, 15 Nov 2021 14:20:20 +0800 Subject: [PATCH] fix error --- .../_ad_banner_widget2_video.html.erb | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/modules/ad_banner/_ad_banner_widget2_video.html.erb b/modules/ad_banner/_ad_banner_widget2_video.html.erb index f58df85..b5a7024 100644 --- a/modules/ad_banner/_ad_banner_widget2_video.html.erb +++ b/modules/ad_banner/_ad_banner_widget2_video.html.erb @@ -48,22 +48,6 @@ }else{ audio_div = $(''); } - audio_div.on('click touchstart',function(event){ - event.stopPropagation(); - var $video = $self.find('video'); - if ($self.hasClass('have-audio')){ - $self.removeClass('have-audio'); - $(this).find('i.fas').attr('class','fas fa-volume-mute'); - }else{ - $self.addClass('have-audio'); - $(this).find('i.fas').attr('class','fas fa-volume-up'); - } - if ($video.length>0){ - $self.jPlayer("mute", !$self.data().jPlayer.options.muted); - }else{//youtube - $self.find('iframe').data("yt_player").unmute(); - } - }) $self.append(audio_div); } } @@ -81,6 +65,23 @@ ad_banners_count++; }) if (typeof onYouTubeIframeAPIReady !== 'function'){ + $(document).on('click touchstart',".jarallax-video-audio",function(event){ + event.stopPropagation(); + var $self = $(this).parent(); + var $video = $self.find('video'); + if ($self.hasClass('have-audio')){ + $self.removeClass('have-audio'); + $(this).find('i.fas').attr('class','fas fa-volume-mute'); + }else{ + $self.addClass('have-audio'); + $(this).find('i.fas').attr('class','fas fa-volume-up'); + } + if ($video.length>0){ + $self.jPlayer("mute", !$self.data().jPlayer.options.muted); + }else{//youtube + $self.find('iframe').data("yt_player").unmute(); + } + }); if(window.yt_players == undefined) window.yt_players = {}; function onYouTubeIframeAPIReady(){