javascript - Can’t seem to grab ID and pass it to inner function -
i’m trying id of element on click, , pass animate function inner function.
i can id can’t seem pass inner function.
$("a").on("click",function() { var id = '#' + $(this).attr('id').substring(2); $('html, body').animate({ // console.log(id); not visible ?! scrolltop: $(id).offset().top }, 2000); });
Comments
Post a Comment