Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-20-2010, 11:52 PM   PM User | #1
timcorley
New to the CF scene

 
Join Date: Jan 2010
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
timcorley is an unknown quantity at this point
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:

Code:
$(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;
	});

});
thanks!
timcorley is offline   Reply With Quote
Old 01-21-2010, 03:30 PM   PM User | #2
tomws
Senior Coder

 
tomws's Avatar
 
Join Date: Nov 2007
Location: Arkansas
Posts: 2,644
Thanks: 29
Thanked 330 Times in 326 Posts
tomws will become famous soon enoughtomws will become famous soon enough
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?
tomws is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:55 AM.


Advertisement
Log in to turn off these ads.