I have used this jquery script on many of my sites with the same theme, settings, etc.
It's in a wordpress Genesis Child theme.
On my current local build, however, when I click on an a href that has the class "scroll", I am getting a console error that reads:
Line 19 of my app.js is this code that I have never had an issue with before:
$(".scroll").click(function () {
if (location.pathname.replace(/^\//, "") === this.pathname
.replace(/^\//, '') && location.hostname === this.hostname
) {
var target = $(this.hash);
target = target.length ? target : $("[name=" + this
.hash.slice(1) + "]");
if (target.length) {
$("html, body").animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
I am running jQuery 3.3.1. I have commented out all code in the app.js to identify where the issue may be coming from. This code is right at the top and I have added console.logs all over the document, which show in Console.
What am I doing wrong here?
Thank you!