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

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -