0
I’m trying to make a page scroll
when I click on a link in my navbar, only when I click I get the following error in the console:
Uncaught Typeerror: Cannot read Property 'top' of Undefined
$(document).ready(function (){
setBindings();
});
function setBindings() {
$("nav a").click(function(e) {
e.preventDefault();
var sectionID = e.currentTarget.id;
$('html, body').animate({
scrollTop: $("#" + sectionID).offset().top
}, 2000);
});
}
I don’t understand, I’m a layman with javascript
the code was from a video I saw on Youtube.
Thanks, I had even given up, was the version of jquery same.
– Guilherme SpinXO