Is it possible to implement smooth scrolling to anchors on нативном JS ?

I used to use JQuery

  $("a.scrollto").click(function() { var elementClick = $(this).attr("href") var destination = $(elementClick).offset().top; jQuery("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination }, 500); return false; }); 

But I want to get away from JQuery , thanks in advance!

  • An example is here . I found it with a search in GOOGLE , the first link for smooth scroll pure js - Kirill Korushkin
  • solve the counter question - why not jQuery? The fact that in the jQuery syntax fit into 7 lines with the declaration, x10 lines will be clean at least 10 lines. Just for such tasks and created it. - Kirill Korushkin
  • With ES6 standards, it is almost as easy and understandable as jQuery and the native syntax is better for me) I can’t beat smooth scrolling just yet) - Sergey Kozin
  • Possible duplicate question: Why can not js-animation on the site? - Air

0