开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜