From c05bf41151c73e4fe26d9c0e6de78d4c8d03dc0c 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:35:20 +0800 Subject: [PATCH] fix error --- .../_ad_banner_widget2_video.html.erb | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/ad_banner/_ad_banner_widget2_video.html.erb b/modules/ad_banner/_ad_banner_widget2_video.html.erb index 654fceb..d4e61c6 100644 --- a/modules/ad_banner/_ad_banner_widget2_video.html.erb +++ b/modules/ad_banner/_ad_banner_widget2_video.html.erb @@ -50,6 +50,19 @@ } audio_div.click(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); } @@ -68,21 +81,8 @@ ad_banners_count++; }) if (typeof onYouTubeIframeAPIReady !== 'function'){ - $(document).on('click touchstart',".jarallax-video-audio",function(event){ - 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(); - } + $(document).on('touchstart',".jarallax-video-audio",function(event){ + $(this).trigger('click'); }); if(window.yt_players == undefined) window.yt_players = {};