从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}