From: Anthony Talarico Date: Fri, 9 Feb 2018 13:05:50 +0000 (-0500) Subject: checking to make sure video is present on the page before trying to play X-Git-Tag: v1.0.20^2~22 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=113608794074c7d4c2b9f96ec4ce3b552d047db9;p=WP-Themes%2Fgaylordmichigan.git checking to make sure video is present on the page before trying to play adding element checking so that the video doesn't get searched for on pages that don't have videos --- diff --git a/js/app.js b/js/app.js index cbb11c0..aad2bca 100644 --- a/js/app.js +++ b/js/app.js @@ -271,7 +271,9 @@ $(document).ready(function () { }); var video = $('#front-page-video'); $(window).on("scroll", function(){ - video.get(0).play(); + if(video.length){ + video.get(0).play(); + } }) $.fn.isInViewport = function() { var elementTop = $(this).offset().top; diff --git a/js/custom/pageSetup.js b/js/custom/pageSetup.js index 6adc236..2812976 100644 --- a/js/custom/pageSetup.js +++ b/js/custom/pageSetup.js @@ -68,7 +68,9 @@ $(document).ready(function () { }); var video = $('#front-page-video'); $(window).on("scroll", function(){ - video.get(0).play(); + if(video.length){ + video.get(0).play(); + } }) $.fn.isInViewport = function() { var elementTop = $(this).offset().top;