Spry Tabs
Spry Tabs are very easy to create, they allow you to organize a page of HTML into a user friendly tabbed interface. For tab panel you don't need a spry region since we won't be working with data.
What You Need
To create a Spry tab panel on your page you need the SpryTabbedPanels.js file no other Spry library files are needed. In addition to the single javascript library file you also need the SpryTabbedPanels.css file.
The Javascript
With most of the beginner spry tutorials there just isn't much javascript to write and the tabbed panel is no exception.
var tp1 = new Spry.Widget.TabbedPanels("myTabPanel");
</script>
The HTML
With all of the Spry widgets or utilities the HTML markup and its classes or id's signal to Spry or the CSS what to do or how its supposed to look. Here
the Tab Panel has specific CSS classes assigned to the HTML tags to create the look of the Tabbed Panel, the ID of the outer DIV tag with the class of "TabbedPanels"
is what gets passed to the Spry TabbedPanels constructor to give the desired functionality.
<ul class="TabbedPanelsTabGroup">
<li class="TabbedPanelsTab" tabindex="0">Tab 1</li>
<li class="TabbedPanelsTab" tabindex="0">Tab 2</li>
<li class="TabbedPanelsTab" tabindex="0">Tab 3</li>
<li class="TabbedPanelsTab" tabindex="0">Tab 4</li>
</ul>
<div class="TabbedPanelsContentGroup">
<div class="TabbedPanelsContent">
<p>You can have all sorts of other HTML markup in your tab panels</p>
<p>You aren't really limited to what you want to put in it</p>
</div>
<div class="TabbedPanelsContent"> Tab 2 Content </div>
<div class="TabbedPanelsContent">Tab 3 Content </div>
<div class="TabbedPanelsContent"> Tab 4 Content</div>
</div>
</div>
The Result
- Tab 1
- Tab 2
- Tab 3
- Tab 4
You can have all sorts of other HTML markup in your tab panels
You aren't really limited to what you want to put in it