Creating Tabs
I. Formatting Tabs
HTML for our version of tabs, Formatting Tabs,
which had CSS styles
for tabs but no tab behavior. The HTML provided in the skeleton
for the assignment had the form
tabpage content here
.........
The basic structure is a list of links followed by a set of
s.
There is one
(a tabpage) for each
(the tab itself)
in the list.
We must associate each with exactly one . To do this,
the href of the tab must match the id of the
corresponding tabpage.
Additionally, only one tab can be displayed at a time so
exactly one tab must have class=selected.
Each of the
s corresponding to the other, unselected tabs
must have class=paneHide.
This is not a particularly complicated structure, but the author
of the page (a human or the backend software creating the page)
must adhere strictly to these guidelines. Any small deviation and
the tabs will not format nicely or work properly.
II. Working Tabs
The jQuery code for Working Tabs uses the same HTML shown above.
Clicking on a tab:
i) "Moves" the "selected" class to the tab just clicked.
ii) The previously shown tabpage is now assigned class=paneHide
ii) paneHide is removed from the tabpage corresponding to the
tab that was clicked.
III. Creating Tabs
Input HTML
News
Content of first tab page. Lorem ipsum dolor sit amet,
Sports
Contents of second tab page. ...
.....
Assumptions
1. The children of '
element.
3. The first heading in the div is used as the label
for the tab.
Output HTML
News
Content of first tab page. Lorem ipsum dolor sit amet