From 08e2f07877077a5694ac15d4e3c1311579c95768 Mon Sep 17 00:00:00 2001 From: Christoph Schindlbeck Date: Fri, 3 Feb 2023 19:52:38 +0100 Subject: [PATCH] fix missing existence check --- themes/infinity-hugo/static/js/main.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/themes/infinity-hugo/static/js/main.js b/themes/infinity-hugo/static/js/main.js index c575071..303d300 100644 --- a/themes/infinity-hugo/static/js/main.js +++ b/themes/infinity-hugo/static/js/main.js @@ -33,17 +33,20 @@ $(document).ready(function(){ $hour = $('#countdown_dashboard').data('hour'); $minute = $('#countdown_dashboard').data('minute'); $second = $('#countdown_dashboard').data('second'); - $('#countdown_dashboard').countDown({ - targetDate: { - 'day': $day, - 'month': $month, - 'year': $year, - 'hour': $hour, - 'min': $minute, - 'sec': $second, - }, - omitWeeks: true - }); + + if ($('#countdown_dashboard').length > 0) { + $('#countdown_dashboard').countDown({ + targetDate: { + 'day': $day, + 'month': $month, + 'year': $year, + 'hour': $hour, + 'min': $minute, + 'sec': $second, + }, + omitWeeks: true + }); + } $(".about-slider").owlCarousel( {