// Tabs
$(".tabgroup > div, .tabgroup .massage").hide();
$(".tabs a").click(function(e){
e.preventDefault();
var $this = $(this),
tabgroup = '#'+$this.parents('.tabs').data('tabgroup'),
others = $this.closest('li').siblings().children('a'),
target = $this.attr('href');
others.removeClass('active');
$this.addClass('active');
$(tabgroup).children('div').hide().removeClass("active");
$(tabgroup).find(".massage").hide();
$(target).show().addClass("active");
$(target).each(function(){
// Show massage
var tik,
i = 0,
massage = $(target).find(".massage"),
massageLength = massage.length;
tik = setInterval(function(){
if (i < massageLength) {
$(massage[i]).fadeIn(500);
i++;
$(".massageList, .custom-scroll_inner").animate({
scrollTop: 9999
}, 1000);
} else {
clearInterval(tik);
}
}, 2000);
});
});
// Auto show first
$(".tabs li:first-of-type a").click();
// Tabs
var tik = [];
$(".tabgroup > div, .tabgroup .massage").hide();
$(".tabs a").click(function(e){
e.preventDefault();
var $this = $(this),
tabgroup = '#'+$this.parents('.tabs').data('tabgroup'),
others = $this.closest('li').siblings().children('a'),
target = $this.attr('href');
others.removeClass('active');
$this.addClass('active');
$(tabgroup).children('div').hide().removeClass("active");
$(tabgroup).find(".massage").hide();
$(target).show().addClass("active");
if(tik.length){
for(var i = 0; i < tik.length; i++){
if(tik[i]) clearInterval(tik[i]);
}
tik = [];
}
$(target).each(function(index){
// Show massage
var i = 0,
massage = $(target).find(".massage"),
massageLength = massage.length;
tik[index] = setInterval(function(){
if (i < massageLength) {
$(massage[i]).fadeIn(500);
i++;
$(".massageList, .custom-scroll_inner").animate({
scrollTop: 9999
}, 1000);
} else {
clearInterval(tik[index]);
}
}, 2000);
});
});
// Auto show first
$(".tabs li:first-of-type a").click();