//封装tabs函数

//封装tabs函数
function tabs(tabTit,on,tabCon){
$(tabCon).each(function(){
$(this).children().eq(0).show();
});
$(tabTit).each(function(){
$(this).children().eq(0).addClass(on);
});
$(tabTit).children().hover(function(){
$(this).addClass(on).siblings().removeClass(on);
var index = $(tabTit).children().index(this);
$(tabCon).children().eq(index).show().siblings().hide();
});
}
//可以反复多次调用 tabs有三个参数,第一个是当前选项,第二个是当前效果,第三个是父元素的子元素显示或隐藏
tabs("#hot","sale-hot","#baby");
原文地址:https://www.cnblogs.com/alone2015/p/5505699.html