要引入jquery库
//tab切换
;(function(){
function Tab(){}
Tab.prototype={
constructor:Tab,
init:function($Content,$btn){
this.$Content.hide().first().show();
this.$btn.removeClass("active").first().addClass("active");
this.clickTab();
},
clickTab:function(){
this.$btn.each(function(index){
$(this).on("click",function(){
$(this).addClass("active").siblings().removeClass("active");
$Content.hide().eq(index).show();
});
});
}
}
var tab=new Tab();
tab.init($(".my-Collect-con"),$(".my-Collect-btn").find("a"));
})();