checking to make sure video is present on the page before trying to play
authorAnthony Talarico <talarico@gaslightmedia.com>
Fri, 9 Feb 2018 13:05:50 +0000 (08:05 -0500)
committerAnthony Talarico <talarico@gaslightmedia.com>
Fri, 9 Feb 2018 13:05:50 +0000 (08:05 -0500)
adding element checking so that the video doesn't get searched for on pages that don't have
videos

js/app.js
js/custom/pageSetup.js

index cbb11c0..aad2bca 100644 (file)
--- 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;
index 6adc236..2812976 100644 (file)
@@ -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;