Adding JS to child theme
-
Hey everyone.
I have been searching the internet trying to find a solution but have not yet.
I will try to provide as much information with out being confusing.
Here is my website I am trying to make changes to:JakeCreative.Guru
I am using this theme: Responsive Mobile
What I am trying to achieve is to have the main navigation to be sticky and ease to certain section of the page. I am try to use some jQuery plugins or code (files are in my child theme directory).
I am having the JS files called but I am getting errors.
Uncaught TypeError: $ is not a function
Uncaught TypeError: jQuery(…).sticky is not a functionI think it has to do with having jQuery called more than once. If so I have not found how to solve that issue. If you know how that would be great information.
Here is the code I am using. It is placed in my child theme’s footer.php file:
... <!-- Script for sticky.js --> <script> jQuery(document).ready(function(){ jQuery("#main-menu-container").sticky({topSpacing:0}); }); </script> <!-- Script for scrollNav.js --> <script> jQuery(document).ready(function(){ jQuery('.main-nav li a').addClass('page-scroll'); }); </script> <!-- Scrolling Scripts for Fixed Nav --> <script src="<?php echo get_stylesheet_directory_uri(); ?>/js/jquery.easing.min.js"></script> <script src="<?php echo get_stylesheet_directory_uri(); ?>/js/scrolling-nav.js"></script> <script src="<?php echo get_stylesheet_directory_uri(); ?>/js/jquery.sticky.js"></script> </body> </html>
Thanks for the help!
- The topic ‘Adding JS to child theme’ is closed to new replies.