码迷,mamicode.com
首页 > 其他好文 > 详细

//封装tabs函数

时间:2016-05-18 17:24:44      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:

//封装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");

//封装tabs函数

标签:

原文地址:http://www.cnblogs.com/alone2015/p/5505699.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!