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 = {};