Create tabs using mootools
How to create three tabs using 开发者_运维问答mootools ?
function mootab(_nav, _body) {
var tabs = $(_nav).getElements('a');
var containers = _body.getElements('li');
tabs.each(function(tab, index) {
tab.addEvents({
click: function(event) {
event.stop();
tabs.removeClass('active');
tabs[index].addClass('active');
containers.removeClass('active');
containers[index].addClass('active');
}
});
});
}
mootab($('tabs-nav'),$('tabs-body'))
The following example is more reusable: Fiddle
精彩评论