webgui/www/extras/yui/examples/tabview/remove_tabs_icon.html
JT Smith cfd09a5cb6 upgraded to yui 0.12.0
upgraded to yui-ext 0.33 rc2
2006-11-28 02:23:34 +00:00

90 lines
3.2 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>TabView Example - Removeable Tabs</title>
<link rel="stylesheet" type="text/css" href="css/example.css">
<link rel="stylesheet" type="text/css" href="../../build/tabview/assets/tabs.css">
<link rel="stylesheet" type="text/css" href="../../build/tabview/assets/border_tabs.css">
<script type="text/javascript" src="../../build/yahoo/yahoo.js"></script>
<script type="text/javascript" src="../../build/event/event.js"></script>
<script type="text/javascript" src="../../build/dom/dom.js"></script>
<script type="text/javascript" src="../../build/tabview/tabview.js"></script>
<style type="text/css">
#demo { width:30em; }
#demo .yui-content { padding:1em; } /* pad content container */
.yui-nav em { margin-right:15px; } /* make room for close icon */
.yui-nav .close {
background:url(img/close12_1.gif) no-repeat;
position:absolute;
right:5px;
height:12px;
width:12px;
text-indent: -9999em;
}
</style>
<script type="text/javascript">
YAHOO.example.init = function() {
var tabView = new YAHOO.widget.TabView('demo');
var removeTab = function(e) {
// only remove if "close" is clicked
if (YAHOO.util.Event.getTarget(e).className == 'close') {
tabView.removeTab(this); /* this == tab */
}
};
tabView.on('contentReady', function() {
YAHOO.util.Dom.batch(tabView.get('tabs'), function(tab) {
tab.set('label', tab.get('label') +
' <span class="close">close</span>');
tab.on('click', removeTab);
});
});
};
YAHOO.example.init();
</script>
</head>
<body>
<div id="doc">
<h1>TabView Example - Removeable Tabs</h1>
<p>This example demonstrates how to position the tabs at the bottom of the view.</p>
<div id="demo" class="yui-navset">
<ul class="yui-nav">
<li class="on"><a href="#lorem"><em>lorem</em></a></li>
<li><a href="#ipsum"><em>ipsum</em></a></li>
<li><a href="#dolor"><em>dolor</em></a></li>
</ul>
<div class="yui-content">
<div id="lorem">
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat.</p>
</div>
<div id="ispum">
<ul>
<li><a href="#">Lorem ipsum dolor sit amet.</a></li>
<li><a href="#">Lorem ipsum dolor sit amet.</a></li>
<li><a href="#">Lorem ipsum dolor sit amet.</a></li>
<li><a href="#">Lorem ipsum dolor sit amet.</a></li>
</ul>
</div>
<div id="dolor">
<form action="#">
<fieldset>
<legend>Lorem Ipsum</legend>
<label for="foo"> <input id="foo" name="foo"></label>
<input type="submit" value="submit">
</fieldset>
</form>
</div>
</div>
</div>
</div>
</body>
</html>