//封装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");
posted @ 2016-05-18 16:28  顺其自然²º¹?  阅读(310)  评论(0编辑  收藏  举报