从iqilu.com上dl下来的。收藏一下
/**
* simpletab plugin
*
* (c) 2009 irobot
*/
/*
* jQuery plugin
*
* Options:
*/
$.fn.extend({
simpletab:function(option){
if(!option)option={};
if(!option.h){option.h='header'}
if(!option.b){option.b='body'}
if(!option.evt){option.evt='click'}
var body=this.find('.'+option.b);
var header=this.find('.'+option.h);
body.children().hide();
header.children().each(function(index){
if($(this).hasClass('current')){
$(body.children().get(index)).show();
}
$(this).bind(option.evt,function(e){
header.children().removeClass('current')
$(this).addClass('current');
body.children().hide();
$(body.children().get(index)).show();
});
});
}
})
使用方法
$('#union').simpletab({'h':'link_header','b':'link_body','evt':'mouseover'});
其中link_header,和link_body是选项卡的头和主题部分。
还需要加一段css .current{display:block}
本文介绍了一个基于jQuery的简单选项卡插件实现方法。通过该插件可以轻松创建网页上的选项卡效果,并提供了基本的配置选项如头部类名、主体类名及触发事件等。
1798

被折叠的 条评论
为什么被折叠?



