What am I doing now?
Spry Tabbed Panels - Changing the opening tab when a page loads 
Monday, October 15, 2007, 10:01 AM - Dreamweaver
Posted by Administrator

l=window.location.search
if (l.indexOf("tab")!=-1) {
s1=l.split("&");
flag=0;
for (var i=0;i<s1.length;i++) {
s2=s1[ i].split("=");
if (s2[0].match(/^[\?]{0,1}tab$/))
flag=s2[1];
}
TabbedPanels1.showPanel(Number(flag));
}

Put that right after the code inserted at the end of the page:

var TabbedPanels1 = new Spry.Widget.TabbedPanels("TabbedPanels1");

Where the TabbedPanels1 is the name of the panels (change this in your code to match your page's tab names)

Then to make a page load a different tab when loaded in a browser, append the URL with tab=## where the ## is from 0 to the number of tabs-1 - this is a JS array which starts with 0, so the tab=0 sets the first tab (which is the default action), while tab=3 opens the fourth tab. This tab=## can appear anywhere in the querystring URL.
6 comments ( 151 views )   |  0 trackbacks   |  permalink   |   ( 2.9 / 410 )

<<First <Back | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Next> Last>>