Lego2012
12/13/2016 - 6:07 PM

Smooth scrolling to in-page sections

Smooth scrolling to in-page sections

jQuery(function( $ ){

    $.localScroll({
        duration: 900
    });
    
});
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.

/**
 * Enqueue scripts for smooth scrolling
 */
add_action( 'wp_enqueue_scripts', 'sk_smooth_scroll' );
function sk_smooth_scroll() {

    wp_enqueue_script( 'scrollTo', get_stylesheet_directory_uri() . '/js/jquery.scrollTo.min.js', array( 'jquery' ), '1.4.5-beta', true );
    wp_enqueue_script( 'localScroll', get_stylesheet_directory_uri() . '/js/jquery.localScroll.min.js', array( 'scrollTo' ), '1.2.8b', true );
    wp_enqueue_script( 'scrollto-init', get_stylesheet_directory_uri() . '/js/scrollto-init.js', array( 'localScroll' ), '', true );

}

<!-- jquery.scrollTo.min.js -->

<!-- jquery.localScroll.min.js -->