diff --git a/js/main.js b/js/main.js index 3a0876e..a2a0f62 100644 --- a/js/main.js +++ b/js/main.js @@ -16,12 +16,12 @@ $(document).ready(function(){ e.preventDefault(); var target = this.hash, - $target = $(target); - - $('html, body').animate({ - 'scrollTop': $target.offset().top-80 - }, 400, 'swing', function () { + if($(target).length){ + $('html, body').animate({ + 'scrollTop': $(target).offset().top - 80 + }, 400, 'swing'); + } }); }); - }); +