To include in the right way in your theme, you need to enqueue jQuery.sticky-kit.js with wp_enqueue_scripts action.
add_action('wp_enqueue_scripts', 'enqueue_sticky_kit');
function enqueue_sticky_kit(){
wp_enqueue_script('sticky-kit', get_stylesheet_directory_uri .'/js/jQuery.sticky-kit.js', array('jquery') );
}
Then in order to use it you’ll need to add a small a little js
$("#sticky_item").stick_in_parent();
// or
$("#sticky_item").stick_in_parent(options);
That can be done with wp_head
action,
add_action('wp_head', 'mycustom_sticky');
function mycustom_sticky(){
// Do what you need
?><script type="text/JavaScript">
$("#sticky_item").stick_in_parent();
</script><?php
}
Have a look to the documentation about jQuery noConflict to not affect other jQuery scripts.
Some jQuery code must be embed like this
jQuery( document ).ready( function( $ ) {
// $() will work as an alias for jQuery() inside of this function
[ your code goes here ]
} );