jQuery or jQuery css but not both
-
site: https://thetrinitymission.org
I have the following code in my <header> in order to make an accordion menu for the mobile visitors:
<nav id="site-navigation" class="main-navigation" role="navigation"> <h3 class="menu-toggle"><?php _e( 'Menu', 'twentytwelve' ); ?></h3> <a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentytwelve' ); ?>"><?php _e( 'Skip to content', 'twentytwelve' ); ?></a> <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu' ) ); ?> </nav><!-- #site-navigation --> <!-- this makes the slide down menu for mobile --> <script type="text/javascript"> $(document).ready(function () { $('#menu-main-navigater > li > a').click(function(){ if ($(this).attr('class') != 'active'){ $('#menu-main-navigater li ul').slideUp(); $(this).next().slideToggle(); $('#menu-main-navigater li a').removeClass('active'); $(this).addClass('active'); } }); }); </script>
This works great so long as this is in my functions.php:
if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11); function my_jquery_enqueue() { wp_deregister_script('jquery'); wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://code.jquery.com/jquery-1.10.1.min.js", false, null); wp_enqueue_script('jquery'); }
However, when I have the above in the functions.php the jquery-ui.css is not loaded so that on another page, my tabs are not styled and all of the content is shown (rather than hidden until the tab is chosen).
To sum up –
?call the script in functions.php => mobile navmenu works tabs do not
?don’t call the script => tabs work mobile navmenu does not
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘jQuery or jQuery css but not both’ is closed to new replies.