I'm trying to autoscroll to some specific place/ID without JQuery. Now I have this block of code with JQuery, this send me to a specific ID with autoscroll.
$(function() {
$('a[href*=#]').on('click', function(e) {
e.preventDefault();
$('html, body').animate({
scrollTop: $($(this).attr('href')).offset().top
}, 900, 'linear');
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href="#one">one</a>
<div id="one"></div>
And I'm looking to do some similar effect but with JavaScript, any idea?