From 113608794074c7d4c2b9f96ec4ce3b552d047db9 Mon Sep 17 00:00:00 2001 From: Anthony Talarico Date: Fri, 9 Feb 2018 08:05:50 -0500 Subject: [PATCH] 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 --- js/app.js | 4 +++- js/custom/pageSetup.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) 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; -- 2.17.1