Skip to content

Instantly share code, notes, and snippets.

@neilgee
Last active November 1, 2018 22:48
Show Gist options
  • Save neilgee/69738b40563ac6753d2946dbb50e4ed2 to your computer and use it in GitHub Desktop.
Save neilgee/69738b40563ac6753d2946dbb50e4ed2 to your computer and use it in GitHub Desktop.
Stick It with Waypoint
<?php
add_action( 'wp_enqueue_scripts', 'prefix_in_browser' );
/**
* Enqueuing Stick it with Waypoints
*/
function prefix_in_browser() {
wp_enqueue_script( 'waypoints', get_stylesheet_directory_uri() . '/js/jquery.waypoints.min.js', array( 'jquery' ), '4.0.1', true );
wp_enqueue_script( 'sticky', get_stylesheet_directory_uri() . '/js/sticky.min.js', array( 'waypoints' ), '1.0.0', true );
wp_enqueue_script( 'waypoints-init', get_stylesheet_directory_uri() . '/js/waypoints.init.js', array( 'sticky' ), '1.0.0', true );
}
jQuery(document).ready(function($) {
var sticky = new Waypoint.Sticky({
element: $('.header-row')[0], // Add in your CSS selector sticky target
direction: 'up right'
})
});
jQuery(document).ready(function($) {
var sticky = new Waypoint.Sticky({
element: $('.header-row')[0], // Add in your CSS selector sticky target
direction: 'down right'
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment