Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active January 2, 2016 04:59
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save srikat/8254164 to your computer and use it in GitHub Desktop.
Save srikat/8254164 to your computer and use it in GitHub Desktop.
Implementing smooth scrolling to in-page links in any Genesis theme. http://sridharkatakam.com/smooth-scrolling-page-links-genesis-theme/
/**
* 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 );
}
<a href="#reason1">Reason 1</a> | <a href="#reason2">Reason 2</a> | <a href="#reason3">Reason 3</a>
This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages as you like and manage all of your content inside of WordPress.
<h4 id="reason1">Reason #1 Why You Should Buy My Product</h4>
This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress. This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages as you like and manage all of your content inside of WordPress.
<h4 id="reason2">Reason #2 Why You Should Buy My Product</h4>
This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress. This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages as you like and manage all of your content inside of WordPress.
<h4 id="reason3">Reason #3 Why You Should Buy My Product</h4>
This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress. This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages as you like and manage all of your content inside of WordPress.
jQuery(function( $ ) {
$.localScroll({
duration: 900
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment