How/where to include javascript for toggling sidebar
-
I’m developing a theme using bootstrap and underscores, and I’m trying to include the toggling sidebar from StartBootstrap.
The issue is that my sidebar is not toggling on and off. See here: https://www.wejazzjune.com/sidebar-page/
I believe it’s not toggling because I am not including the relevant javascript properly.
This is the script:
$("#menu-toggle").click(function(e) { e.preventDefault(); $("#wrapper").toggleClass("toggled"); });
I’ve included that script verbatim in a file called shove.js. I’ve enqueued shove.js via functions.php with this line of code:
wp_enqueue_script( 'shove', get_template_directory_uri() . '/js/shove.js', array( 'jquery' ), '1.0.0', true );
But it’s not working. I’m sure I’m doing something wrong here.
The syntax of my javascript file may be wrong or incomplete, or the enqueue code could be wrong or imcomplete, I think. Also, do I need to include jquery.js in my js folder (I’ve done so), or is that redundant / causing a problem?
Really lost here, so any help is appreciated!
- The topic ‘How/where to include javascript for toggling sidebar’ is closed to new replies.