Sidr Jquery Plugin & wordpress
-
Hello All,
I am new to this so please bare with me, I want to create a slide out Navigation using the primary menu. I would like to use the Sidr jquery plugin. I have attached all the necessary code including a init.js script to initialize the Sidr Plugin and the necessary .css for the template. below you will find the code that I am using in my functions.php file:
//* Enqueue Sidr and Touchwipe jQuery plugins add_action( 'wp_enqueue_scripts', 'enqueue_sidr_touchwipe' ); function enqueue_sidr_touchwipe() { wp_enqueue_script( 'sidr', get_stylesheet_directory_uri() . '/js/jquery.sidr.min.js', array( 'jquery' ), '1.0.0', true ); wp_enqueue_script( 'sidr-init', get_stylesheet_directory_uri() . '/js/jquery.sidr.min.init.js', array( 'sidr' ), '1.0.0', true ); wp_enqueue_style( 'sidr-css', get_stylesheet_directory_uri() . '/css/jquery.sidr.dark.css' ); // to make the right/left swipe touch event open or close the responsive menu wp_enqueue_script( 'touchwipe', get_stylesheet_directory_uri() . '/js/jquery.touchwipe.min.js', array( 'jquery' ), '1.0.0', true ); wp_enqueue_script( 'touchwipe-init', get_stylesheet_directory_uri() . '/js/jquery.touchwipe.min.init.js', array( 'touchwipe' ), '1.0.0', true ); }the files include on my server are:
jquery.sidr.min.js
jquery.sidr.min.init.js :jQuery(document).ready(function($) { $('#primary-nav-link').sidr({ name: 'sidr-primary-nav', source: '#primary-nav-container' }); });jquery.touchwipe.min.js
jquery.touchwipe.min.init.js
jquery.sidr.dark.cssis there anyone that could help me out on this issue, it would be highly appreciated.
thanks:)
-
Can you explain the issues you face?
Hello Andrew thank you for your reply,
its simply does not work the menu stays the same. Also when I troubleshoot the problem, through my console on chrome dev tools, it gives me this error:
Uncaught SyntaxError: Unexpected token < Uncaught SyntaxError: Unexpected token <This error appears twice,
sometimes i even get an error telling me that the css or jquery was interpreted as a style or a script but it was rendered as html.
thanks
You need to link the page with the issue
http://isisboutiqueinc.com/dev2014/
i have also attached a style sheet that is part of the jquery plugin i would like to use, but the function is not working.
wp_enqueue_style( 'sidr-css', get_stylesheet_directory_uri() . '/css/jquery.sidr.dark.css' );I don’t think this function “get_stylesheet_directory_uri()” is working properly.
Try echoing that to see what it returns.added the function <?php echo get_stylesheet_directory_uri(); ?> to the functions.php and it returned up until the theme folder and not passed it to the css folder.
The topic ‘Sidr Jquery Plugin & wordpress’ is closed to new replies.