PDA

View Full Version : Complicated Ajax Tabs implementation



synergy
02-28-2008, 06:05 PM
1) Script Title:
Ajax Tabs v2.0

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/

3) Website:
http://www.artisanmantels.com

4) Describe problem:

This is fairly complex and I've had help from you guys getting it to work one way, but I am changing it a bit.

I have a nested tabs page within a tabs page. (See Our Product tab on website). I want to load one of the sub tabbed pages (Our Product > Pricing and Specs) when you click the "Product Pricing and Specs" link on the right "Popular Places" container.

So in other words I want a tab of a tab to open in my main "countries" container when a link is clicked from outside the tabs menu....make sense?

I've beat my brain on how to do this and can't come up with a solution. Any suggestions? Can it even be done?

Thanks in advance.

lazywolfy
02-28-2008, 06:20 PM
Maybe this thread will help you, it's not for the Ajax tabs but it's for the similar tabbed content script...it might help (or not)....good luck!

http://www.dynamicdrive.com/forums/showthread.php?t=29823

synergy
02-28-2008, 06:44 PM
Thanks for the suggestion, but I can't get it to work. It looks more like a solution to v1 of the script.

ddadmin
02-28-2008, 10:49 PM
There are many ways to select a nested tab from outside the tabs interface itself. The easiest way is to add to your onajaxpageload event handler the code in red below:


countries.onajaxpageload=function(pageurl){
if (pageurl.indexOf("externalnested.htm")!=-1){
var provinces=new ddajaxtabs("provincetabs", "provincedivcontainer")
provinces.setpersist(true)
provinces.setselectedClassTarget("link") //"link" or "linkparent"
provinces.init()
if (typeof nestedtabindex!="undefined" && nestedtabindex>-1)
provinces.expandit(nestedtabindex)
nestedtabindex=-1
}

This registers a variable nestedtabindex that you can set anywhere on your page to select the "x" nested tab (0=1st tab). So for example, you may have:


<a href="#" onClick="countries.expandit(1); nestedtabindex=2">Select "2nd" tab</a>

This link when clicked on first selects the 2nd main tab, and when its Ajax Content loads, selects the 3rd nested tab within it.

synergy
02-29-2008, 06:32 PM
That worked great. Thanks!