DOMAssistant-Tabs plugin

French language flag Easy Tabs for your pages...


Purpose of the script

This plugin can be used to create a tabs based navigation system using the html structure of a block element. (titles h1, h2... ; or whatever pre-identified tag)

Using...

Preparing...

Insert this code in the header of the page :

<link rel="stylesheet" type="text/css" href="lib/css/DOMAssistant-Tabs.css" />
<script type="text/javascript" src="lib/js/DOMAssistantCompressed-2.8.js"></script>
<script type="text/javascript" src="lib/js/DOMAssistant-Tabs.plugin.js"></script>
<script type="text/javascript" src="lib/js/tabsLauncher.js"></script>

Please, modify lib/css/ and lib/js/ according to your respective css and js directories.

Html code

<div id="wrapper">
	<h2>tab title</h2>
	<p>tab content</p>
	<h2>Second tab title</h2>
	<p>Second tab content</p>
	[...]
</div>

Javascript code (DOMAssistant)

$("#wrapper").toTabs("h2").addClass("bg1");

doTabs() method returns a DOM reference to the element on wich it is called (here : "wrapper").
Above example will apply "bg1" class to the element which id is "wrapper" after having created tabs.

Generated html code

<div id="wrapper">
	<div class="DATGpart" id="DATGpart_0">
		<div class="DATtagsBg">
			<ul id="DATtCont_0" class="ongletsCont">
				<li class="DATonglet"><a id="link_0_3" href="#">tab title</a></li>
				<li class="DATonglet"><a id="link_0_2" href="#">Second tab title</a></li>
				[...]
			</ul>
		</div>
		<div class="partsCont">
			<div id="DATpart_0_3" class="DATpart0">
				<h2>tab title</h2>
				<p>tab content</p>
			</div>
			<div style="display: none;" id="DATpart_0_2" class="DATpart0">
				<h2>Second tab title</h2>
				<p>Second tab content</p>
			</div>
		</div>
	[...]
	</div>
</div>

Used styles

div.DATtagsBg{
background:#fff url(../graph/onglets_bg.gif) left bottom repeat-x;
font-size:0.5em;
height: 2.0em;
}
ul.ongletsCont {
margin: 0 0 0 1em;
padding: 0.1em 0.5em 0;
list-style: none;
}
.ongletsCont li {
float: left;
margin: 0.2em 0 0 0;
padding: 0 0 0 0.5em;
line-height: 1.5em;
}
.ongletsCont a {
/* IE Mac only hack \*//*/
float:left;
/**/
display: block;
padding: 0.1em 1em 0.15em 0.5em;
text-decoration: none;
font-weight: bold;
color: #765;
outline: none;
}
.ongletsCont a:hover {
color: #333;
}
.ongletsCont li.DATonglet {
background: url(../graph/onglets_left.gif) no-repeat left top;
}
.ongletsCont li.DATonglet a {
background: url(../graph/onglets_right.gif) no-repeat right top;
}
.ongletsCont li.DATonglet.on {
background: url(../graph/onglets_left_on.gif) no-repeat left top;
line-height: 1.7em;
margin-top: 0;
}
.ongletsCont li.DATonglet.on a {
background: url(../graph/onglets_right_on.gif) no-repeat right top;
color: #333;
padding-bottom: 0.15em;
}

/*Content displayed after one tab has been clicked*/
div.partsCont {
clear: both;
border-width: 0 2px 2px 2px;
border-color: #000;
border-style: ridge;
padding: 1em 2em;
margin-top: 0;
background: #FDFDFC;
color: #080808;
}

Download icon Download DOMAssistant-Tabs

"Download DOMAssistant-Tabs" icon by Alexandre Moore

Version

Actual version is 0.3 (for DOMAssistant 2.7 and sup.)

Archive content

Licence

DOMAssistant-Tabs is released under MIT licence.

The MIT License

Copyright (c) 2008 Samuel Desno√ęs
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Credits

Css and graphic example Alistapart.com.

© iFacta Project - 2008