JSFiddle - React, Tailwind, and code Playground

by envira

HTML

<div class="article-content">
    <div id="title1">
        <a href="#title2" id="next">next</a>
        <h2>Title1</h2>
    </div>        
      I want to prepare a smooth scrooling effect between titles using html nad jQuery. By pressing button "next" user is moved to the closest, next title. 0 down vote favorite I want to prepare a smooth scrooling effect between titles using html nad jQuery. By pressing button "next" user is moved to the closest, next title. I want to prepare a smooth scrooling effect between titles using html nad jQuery. By pressing button "next" user is moved to the closest, next title. 0 down vote favorite I want to prepare a smooth scrooling effect between titles using html nad jQuery. By pressing button "next" user is moved to the closest, next title. 0 down vote favorite I want to prepare a smooth scrooling effect between titles using html nad jQuery. By pressing button "next" user is moved to the closest, next title. 0 down vote favorite I want to prepare a smooth scrooling effect between titles using html nad jQuery. By pressing button "next" user is moved to the closest, next title. I want to prepare a smooth scrooling effect between titles using html nad jQuery. By pressing button "next" user is moved to the closest, next title. 0 down vote favorite I want to prepare a smooth scrooling effect between titles using html nad jQuery. By pressing button "next" user is moved to the closest, next title. 0 down vote favorite I want to prepare a smooth scrooling effect between titles using html nad jQuery.   
    
    
    I want to prepare a smooth scrooling effect between titles using html nad jQuery. By pressing button "next" user is moved to the closest, next title. 0 down vote favorite I want to prepare a smooth scrooling effect between titles using html nad jQuery. By pressing button "next" user is moved to the closest, next title. I want to prepare a smooth scrooling effect between titles using html nad jQuery. By pressing button...

JavaScript

$("a").on('click', function(e) {
       // prevent default anchor click behavior
        e.preventDefault();
 
       $('html, body').animate({
           scrollTop: $(this.hash).offset().top
         }, 1000, function(){
            window.location.hash = this.hash;
         });

 });