Java Reference
In-Depth Information
border: 1px solid #316AC5;
background-color: #C1D2EE;
padding: 2px;
}
 
.tabStrip-tab-click {
border: 1px solid #facc5a;
background-color: #f9e391;
padding: 2px;
}
</style>
 
</head>
<body>
<div class="tabStrip">
<div data-tab-number="1" class="tabStrip-tab">Tab 1</div>
<div data-tab-number="2" class="tabStrip-tab">Tab 2</div>
<div data-tab-number="3" class="tabStrip-tab">Tab 3</div>
</div>
<div id="descContainer"></div>
 
<script src="mootools-core-1.5.1-compressed.js"></script>
<script>
function handleEvent(e) {
var target = e.target;
var type = e.type;
 
if (type == "mouseover" ││ type == "mouseout") {
target.toggleClass("tabStrip-tab-hover");
} else if (type == "click") {
target.addClass("tabStrip-tab-click");
 
var num = target.getAttribute("data-tab-number");
showDescription(num);
}
}
 
function showDescription(num) {
var text = "Description for Tab " + num;
 
$("descContainer").set("html", text);
}
 
$$(".tabStrip > div").addEvents({
mouseover: handleEvent,
mouseout: handleEvent,
click: handleEvent
});
</script>
</body>
</html>
Save this file as ch17 _ example6.html , and open it in your browser ( http://beginningjs.com/examples/
ch17 _ example6.html is available, too). Notice that this page works just like all the other versions.
Search WWH ::




Custom Search