Title: Jquery tabs problem
Last modified: August 19, 2016

---

# Jquery tabs problem

 *  [Mr. Bigsby](https://wordpress.org/support/users/holgria/)
 * (@holgria)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/jquery-tabs-problem/)
 * I’m having a problem with a jquery tabbed navigation system. I have to use the
   plugin “use google code” to get the tabs to work, however when i install anything
   else that uses jquery the tabs stop working, (especially Fancybox for WordPress,
   any slider etc.)
 * Here is the tabs.js
 *     ```
       $(document).ready(function(){
       	$(".tabsmenu > li").click(function(e){
       		switch(e.target.id){
       			case "local":
       				//change status & style menu
       				$("#local").addClass("active");
       				$("#national").removeClass("active");
       				$("#international").removeClass("active");
       				$("#israel").removeClass("active");
       				//display selected division, hide others
       				$("div.local").fadeIn();
       				$("div.national").css("display", "none");
       				$("div.international").css("display", "none");
       				$("div.israel").css("display", "none");
       			break;
       			case "national":
       				//change status & style menu
       				$("#local").removeClass("active");
       				$("#national").addClass("active");
       				$("#international").removeClass("active");
       				$("#israel").removeClass("active");
       				//display selected division, hide others
       				$("div.national").fadeIn();
       				$("div.local").css("display", "none");
       				$("div.international").css("display", "none");
       				$("div.israel").css("display", "none");
       			break;
       			case "international":
       				//change status & style menu
       				$("#local").removeClass("active");
       				$("#national").removeClass("active");
       				$("#international").addClass("active");
       				$("#israel").removeClass("active");
       				//display selected division, hide others
       				$("div.international").fadeIn();
       				$("div.local").css("display", "none");
       				$("div.national").css("display", "none");
       				$("div.israel").css("display", "none");
       			break;
       			case "israel":
       				//change status & style menu
       				$("#local").removeClass("active");
       				$("#national").removeClass("active");
       				$("#international").removeClass("active");
       				$("#israel").addClass("active");
       				//display selected division, hide others
       				$("div.israel").fadeIn();
       				$("div.local").css("display", "none");
       				$("div.national").css("display", "none");
       				$("div.international").css("display", "none");
       			break;
       		}
       		//alert(e.target.id);
       		return false;
       	});
       });
       ```
   
 * I tried checking no jquery loading in fancybox, but that doesnt seem to help.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [David Calhoun](https://wordpress.org/support/users/dpcalhoun/)
 * (@dpcalhoun)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/jquery-tabs-problem/#post-1947113)
 * This may be of use: [http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers](http://codex.wordpress.org/Function_Reference/wp_enqueue_script#jQuery_noConflict_wrappers)
 *  Thread Starter [Mr. Bigsby](https://wordpress.org/support/users/holgria/)
 * (@holgria)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/jquery-tabs-problem/#post-1947160)
 * I tried adding both of those codes to the top of my code (tabs.js) above and 
   neither seemed to help once I activated fancybox for wordpress.
 *     ```
       jQuery(document).ready(function($) {
           // $() will work as an alias for jQuery() inside of this function
       });
       ```
   
 *     ```
       (function($) {
           // $() will work as an alias for jQuery() inside of this function
       })(jQuery);
       ```
   
 * I’m new to all of this jquery stuff, but I appreciate your help.
 * I also tried deactivating “the plugin “use google code” but that did not help
   either.
    here’s the only two js in the header with just the tabs loaded
 *     ```
       <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js'></script>
        <script type="text/javascript" src="js/tabs.js"></script>
       </head>
       ```
   
 * There is some in the footer as well,but right now I’m not having a conflict as
   long as I don’t enable fancybox for wordpress (even if I select do not load jquery
   and load in noconflict it’s not working).
 *  [Alwyn Botha](https://wordpress.org/support/users/123milliseconds/)
 * (@123milliseconds)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/jquery-tabs-problem/#post-1947162)
 * If you install Firefox Firebug then when you visit your website you can immediately
   see 404 not found errors; maybe those js are not even loading
 *  Thread Starter [Mr. Bigsby](https://wordpress.org/support/users/holgria/)
 * (@holgria)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/jquery-tabs-problem/#post-1947202)
 * no 404 errors.
 *  [David Gwyer](https://wordpress.org/support/users/dgwyer/)
 * (@dgwyer)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/jquery-tabs-problem/#post-1947208)
 * A link to your site would be useful. Also, I don’t know if it is the Plugin you
   are using that is causing the problem, never used it myself.
 * Also, I blogged about getting jQuery UI widgets active on your blog posts a while
   ago. You might want to take a look.
 * [http://www.presscoders.com/jquery-ui-widgets-on-blog-pages/](http://www.presscoders.com/jquery-ui-widgets-on-blog-pages/)
 * The approach I use is to load the Google jQuery UI library as it includes ALL
   UI functionality. However the jQuery UI library that ships with WordPress 3.1
   includes all UI widgets apart from the accordion. So, if it is the tabs component
   you need you can just use what is included with WordPress.
 * Just add something like this to your themes functions.php file say (or you can
   create your own Plugin file):
 *     ```
       add_action( 'init', 'jquid_init' );
   
       // Register the blog scripts
       function jquid_init(){
       	if(!is_admin()){ // Only load these scripts on non-admin pages
       		wp_enqueue_script( 'jquery' );
       		wp_enqueue_script( 'jquery-ui-core', array('jquery') );
       		wp_enqueue_script( 'jquery-ui-widget', array('jquery-ui-core') );
       		wp_enqueue_script( 'jquery-ui-tabs', array('jquery-ui-widget') );
       	}
       }
       ```
   
 * This should load the correct jQuery UI libraries that ship with WordPress 3.1,
   in the right order, and with the correct dependencies as specified here (right
   hand side of the page, half way down):
 * [http://jqueryui.com/demos/tabs/](http://jqueryui.com/demos/tabs/)
 * Once the libraries are loading correctly (view page source, or use Firebug to
   check this) you can use the standard jQuery code to set up your tabs. I do this
   in my blog post via a shortcode so the jQuery code ONLY gets inserted into the
   posts you want to show tabs on. Otherwise it will get loaded on every single 
   page.
 * To do a simple shortcode for jQuery tabs just add this code to your theme functions.
   php file (or your custom Plugin):
 *     ```
       add_shortcode('jQuery-UI-tabs', 'jquid_tabs_shortcode');
       function jquid_tabs_shortcode(){
       	echo '
       	<script>
       	jQuery(document).ready(function($) {
       		$( "#tabs" ).tabs();
       	});
       	</script>
       	';
       }
       ```
   
 * Then in your post editor, where you want tabs to appear, add:
 *     ```
       [jQuery-UI-tabs]
   
       <div id="tabs">
   
       <ul>
       <li><a href="#tabs-1">Nunc tincidunt</a></li>
       <li><a href="#tabs-2">Proin dolor</a></li>
       <li><a href="#tabs-3">Aenean lacinia</a></li>
       </ul>
       	<div id="tabs-1">
       		<p>Proin elit arcu, rutrum commodo, vehicula tempus, commodo a, risus. Curabitur nec arcu. Donec sollicitudin mi sit amet mauris. Nam elementum quam ullamcorper ante. Etiam aliquet massa et lorem. Mauris dapibus lacus auctor risus. Aenean tempor ullamcorper leo. Vivamus sed magna quis ligula eleifend adipiscing. Duis orci. Aliquam sodales tortor vitae ipsum. Aliquam nulla. Duis aliquam molestie erat. Ut et mauris vel pede varius sollicitudin. Sed ut dolor nec orci tincidunt interdum. Phasellus ipsum. Nunc tristique tempus lectus.</p>
       	</div>
       	<div id="tabs-2">
       		<p>Morbi tincidunt, dui sit amet facilisis feugiat, odio metus gravida ante, ut pharetra massa metus id nunc. Duis scelerisque molestie turpis. Sed fringilla, massa eget luctus malesuada, metus eros molestie lectus, ut tempus eros massa ut dolor. Aenean aliquet fringilla sem. Suspendisse sed ligula in ligula suscipit aliquam. Praesent in eros vestibulum mi adipiscing adipiscing. Morbi facilisis. Curabitur ornare consequat nunc. Aenean vel metus. Ut posuere viverra nulla. Aliquam erat volutpat. Pellentesque convallis. Maecenas feugiat, tellus pellentesque pretium posuere, felis lorem euismod felis, eu ornare leo nisi vel felis. Mauris consectetur tortor et purus.</p>
       	</div>
       	<div id="tabs-3">
       		<p>Mauris eleifend est et turpis. Duis id erat. Suspendisse potenti. Aliquam vulputate, pede vel vehicula accumsan, mi neque rutrum erat, eu congue orci lorem eget lorem. Vestibulum non ante. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Fusce sodales. Quisque eu urna vel enim commodo pellentesque. Praesent eu risus hendrerit ligula tempus pretium. Curabitur lorem enim, pretium nec, feugiat nec, luctus a, lacus.</p>
       		<p>Duis cursus. Maecenas ligula eros, blandit nec, pharetra at, semper at, magna. Nullam ac lacus. Nulla facilisi. Praesent viverra justo vitae neque. Praesent blandit adipiscing velit. Suspendisse potenti. Donec mattis, pede vel pharetra blandit, magna ligula faucibus eros, id euismod lacus dolor eget odio. Nam scelerisque. Donec non libero sed nulla mattis commodo. Ut sagittis. Donec nisi lectus, feugiat porttitor, tempor ac, tempor vitae, pede. Aenean vehicula velit eu tellus interdum rutrum. Maecenas commodo. Pellentesque nec elit. Fusce in lacus. Vivamus a libero vitae lectus hendrerit hendrerit.</p>
       	</div>
       </div>
       ```
   
 * Then just change the html to whatever you want to display for each tab! That 
   should give you enough to get going. 🙂
 * By the way the discussion above supports only one tab instance per post/page 
   so if you wish to get multiple tabs working on a single page then you need to
   use something like:
 * [http://flowplayer.org/tools/demos/tabs/multiple.html](http://flowplayer.org/tools/demos/tabs/multiple.html)
 *  Thread Starter [Mr. Bigsby](https://wordpress.org/support/users/holgria/)
 * (@holgria)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/jquery-tabs-problem/#post-1947369)
 * link to site: a_mericanis_raelite.com no _’s.
 * taken from here: [http://yensdesign.com/2008/12/create-a-smooth-tabbed-menu-in-jquery/](http://yensdesign.com/2008/12/create-a-smooth-tabbed-menu-in-jquery/)

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Jquery tabs problem’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 4 participants
 * Last reply from: [Mr. Bigsby](https://wordpress.org/support/users/holgria/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/jquery-tabs-problem/#post-1947369)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
