Can I anchor an individual tab

Is is possible to open a page that has jquery tabs on it and open right to that tab.  So if it is not the first tab, but say the third, in this one case that one would open.
solsticeintAsked:
Who is Participating?
 
leakim971PluritechnicianCommented:
you links :

<a href="page_with_tabs.php?tab=0">Sales</a>
<a href="page_with_tabs.php?tab=1">Services</a>
<a href="page_with_tabs.php?tab=2">General Information</a>
<a href="page_with_tabs.php?tab=3">Sales Representatives</a>
<a href="page_with_tabs.php?tab=4">International Distributors</a>

and on page_with_tabs.php you have :

$(document).ready(function() {

$( ".selector" ).tabs({ selected: gup("tab") }); // http://www.netlobo.com/url_query_string_javascript.html
//or :
//$( ".selector" ).tabs({ selected: $.getUrlVar('tab') }); // http://jquery-howto.blogspot.com/2009/09/get-url-parameters-values-with-jquery.html

})
0
 
Sudaraka WijesingheWeb Application ProgrammerCommented:
You need to use the selected option.
See http://jqueryui.com/demos/tabs/#option-selected
0
 
leakim971PluritechnicianCommented:
check the selected option : http://jqueryui.com/demos/tabs/#option-selected

// but say the third
$( ".selector" ).tabs({ selected: 2 }); // auto open the third tab
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
solsticeintAuthor Commented:
What if I wanted to open all 5 tabs, based on 5 different links off another page?
0
 
leakim971PluritechnicianCommented:
at the same time?
0
 
solsticeintAuthor Commented:
What I have is 5 different contact forms on a contact page.  Each in its own tab.  One for Sales, one for Services, General Information, Sales Representatives, one for International Distributors.  I would like to be able to directly link to the page and correct form tab throughout the site.  I have done this with anchors in the past and plain pages, but not with tabs.  
0
 
solsticeintAuthor Commented:
I have attached what I have so far.  I could use your thoughts on the best way to incorporate it.

Thank you
$(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
			
			$(".inner-tab_content").hide(); //Hide all content
			$("ul.inner-tabs li:first").addClass("active").show(); //Activate first tab
			$(".inner-tab_content:first").show(); //Show first tab content
		
			//On Click Event
			$("ul.tabs li").click(function() {
		
				$("ul.tabs li").removeClass("active"); //Remove any "active" class
				$(this).addClass("active"); //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).fadeIn(); //Fade in the active ID content
				return false;
			});
		
			//On Click Event
			$("ul.inner-tabs li").click(function() {
		
				$("ul.inner-tabs li").removeClass("active"); //Remove any "active" class
				$(this).addClass("active"); //Add "active" class to selected tab
				$(".inner-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).fadeIn(); //Fade in the active ID content
				return false;
			});
		
		});
	</script>

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.