I’ve recently tried to install the jQuery Slidr plugin for my custom wordpress theme but haven’t had any luck getting it to work. When I try to call the sidebar to appear by binding it to my ‘#mobile-menu’ anchor tag I get this error in my console, “TypeError: $(…).sidr is not a function”.
Here’s how my code is laid out:
functions.php
function wpbootstrap_scripts_with_jquery()
{
wp_register_script( 'init', get_template_directory_uri() . '/javascripts/initialize.js' , array( 'jquery' ), '1.0', true );
wp_register_script( 'sidr', get_template_directory_uri() . '/javascripts/jquery.sidr.min.js' , array( 'jquery' ), '1.0', true );
wp_enqueue_script( 'init' );
wp_enqueue_script( 'sidr' );
}
add_action( 'wp_enqueue_scripts', 'wpbootstrap_scripts_with_jquery' );
initialize.js
(function($) {
$('#mobile-menu').sidr();
})(jQuery);
Link to my site: http://www.xboxoneachievementguides.com
Please try this, i have checked its running