Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Can I anchor an individual tab

Posted on 2011-10-09
7
Medium Priority
?
224 Views
Last Modified: 2012-05-12
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.
0
Comment
Question by:solsticeint
  • 3
  • 3
7 Comments
 
LVL 18

Expert Comment

by:Sudaraka Wijesinghe
ID: 36939855
You need to use the selected option.
See http://jqueryui.com/demos/tabs/#option-selected
0
 
LVL 83

Expert Comment

by:leakim971
ID: 36939889
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
 

Author Comment

by:solsticeint
ID: 36939890
What if I wanted to open all 5 tabs, based on 5 different links off another page?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 83

Expert Comment

by:leakim971
ID: 36939906
at the same time?
0
 

Author Comment

by:solsticeint
ID: 36939913
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
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 36939941
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
 

Author Comment

by:solsticeint
ID: 36939953
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Suggested Courses
Course of the Month14 days, 15 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question