$(function(){ tabs("#cptabhd","active","#cptabbd"); $("#yb_conct").hover(function() { $("#yb_conct").css("right", "5px"); $("#yb_bar #yb_ercode").css('height', '200px'); $("#yb_QQ").css("height","70px"); $("#yb_QQ1").css("height","60px"); $("#yb_phone").css("height","75px"); }, function() { $("#yb_conct").css("right", "-127px"); $("#yb_bar #yb_ercode").css('height', '53px'); $("#yb_QQ").css("height","53px"); $("#yb_QQ1").css("height","53px"); $("#yb_phone").css("height","53px"); }); $("#yb_top").click(function() { $("html,body").animate({ 'scrollTop': '0px' }, 300) }); }) 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(); }); }