Configuration
You can create a tab set and pass it a few options to customize it to your current page structure. By default, the code will search for tabs by using the class name "tab", and tab content using the class name "panel". It also will apply the class name "selected" to the currently selected tab.
You may also have noticed that the id attributes for the tags and tag content started with either "tab_" or "panel_". This is a way to link a tab with its specific content while still keeping the ids unique. You can change these in the configuration as well.
Finally, if you wanted, you can turn off the fade effect, and also change the event that triggers the tab activation.
Below is an example of how you can pass options to your tab set.
var tabs = new tabset('container', {
classNames: {
tab: 'tab', // class name used to identify the tabs
panel: 'panel', // class name used to identify the tab content
tabActive: 'selected' // class name added to the active tab
},
ids: {
tab: 'tab_', // what to strip off the tab id to get the tab name
panel: 'panel_' // what to strip off the tab content id to get the tab name
},
onEvent: 'click', // perhaps you want to activate on mouseover? not recommended
effects: true // set this to false if you do not want to include effects.js
});
Clever bit of coding. I was wondering the same thing as a previous commenter. This is so cool. I’m wondering whether this stereotabs can be integrated with velocity menu
I’ll skim back over in cased I missed it
I have one question: I tried to add the ‘display:none;’ to the ‘.panel’ style (from a comment toward the beginning) to eliminate the flash of content while the page loads, but for some reason the panels don’t come back when you click on the links.
Is there something else I need to add to the js to get them to reappear?
Pingback: Blogawker Best Tabs for Word Press - Blogawker
I’m having an issue where my content for one set of tabs isn’t appearing when the page loads. I’m currently using two stereotabs within the same page. The first set of tabs/links is used to reveal a sub set of tabs/links. The seconds set then is used to reveal the content. The content for the sub set is not appearing on load. Any help would be much appreciated. Thanks.
I’m having a bit of trouble with this. Including jquery seems to break the tabs. I saw that you said you shouldn’t include prototype and jquery on the same page. First, why not, and second, how do I get my jquery code running within the tabs?
@Mark, you should make sure you are running jQuery in compatibility mode or else jQuery and prototype both compete to use the global “$” function. http://docs.jquery.com/Using_jQuery_with_Other_Libraries
Hi Scott,
Many thanks for your brilliant script. All works for me but i am having issues with google maps not displaying all the map within the tab.
What happens is that 3/4 of the maps is greyed out.
I have done many research and the issue (i think) is that the maps is not re-sized when the tab is clicked.
The suggested command(s) to use is:
map.checkResize();
or
google.maps.event.trigger(map, ‘resize’);
My issue is that I do not know where to place this code, and in which script.
Can you or anyone help please.
This page has a list of similar issues (
http://groups.google.com/group/google-maps-js-api-v3/search?group=google-maps-js-api-v3&q=hidden+div&qt_g=Search+this+group)