Technologies: jQuery, JavaScript, WordPress

WordPress:
1. Download, unzip and add the smooth-scroll.js to your theme's JS folder.
2. Next, goto Appearance -> Editor. Open the Theme Functions (functions.php) file.
3. At the bottom of the file add the below code:
Note: Depending on the theme, you need to make sure you are inside the PHP closing tag.


function myscripts() {

    $script = get_template_directory_uri() . '/js/smooth-scroll.js';
    wp_register_script( 'smoothscroll-js', $script , '', '', true );

    //always enqueue the script after registering or nothing will happen
    wp_enqueue_script('smoothscroll-js');
     
}
add_action("wp_enqueue_scripts", "myscripts");

4. Now you need to set a href link to your desired location.
5. And your destination will be an element with the same id as the link. See the Codepen example below

Non-WordPress
Follow the instructions above and instead of step 3, you will need to use a script tag in your index.html

See the Pen Smooth Scroll Example by Jeremy (@J-Roel) on CodePen.