Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2010
    Thanked 0 Times in 0 Posts

    Tabs - showing separate div on tab click

    I have jquery tabs setup on a page and they work fine. I'm trying to make it so that when a user clicks on a tab, info appears in the main-content area below the tab, but also in the sidebar....The main-content div and the sidebar div are not wrapped together....

    example: if a user clicks 'investment consulting' - I want the investment consulting info to appear below the tab, but I also want the pricing to show up in the sidebar. There are 2 main tabs, 1 for investment consulting and 1 for broker consulting, so the pricing would change in the sidebar for each tab....

    I have the page live at the following URL: http://www.rxaftermath.com/nyc-reale...onsulting.html

    I tried binding some elements in the javascript, and though the correct pricing showed up when the tab was clicked, the other info disappeared. Im sure its my code since im a jquery noob....Any help would be greatly appreciated!! even just a point in the right direction.......

    heres my javascript:

    $(document).ready(function() {
    	//When page loads...
    	$(".tab_content").hide(); //Hide all content
    	$("ul.tabs li:first").addClass("active").show(); //Activate first tab
    	$(".tab_content:first").show(); //Show first tab content
    	//On Click Event
    	$("ul.tabs li").click(function() {
    		$("ul.tabs li").removeClass("selected"); //Remove any "active" class
    		$(this).addClass("selected"); //Add "active" class to selected tab
    		$(".tab_content").hide(); //Hide all tab content
    		var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
    		$(activeTab + "_price").show(); //Fade in the active ID content
    		return false;

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Thanked 330 Times in 326 Posts
    Did you get this fixed? It works here, I think. I see the pricing added to the side and the other blocks shifted down.
    Are you a Help Vampire?


    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts