// JavaScript Document /*tab*/ function tab(nav,content,on,type) { $(nav).children().bind(type,(function(){ var $tab=$(this); var tab_index=$tab.prevAll().length; var $content = $(content).children(); $(nav).children().removeClass(on); $tab.addClass(on); $content.hide(); $content.eq(tab_index).show(); //$content.eq(tab_index).fadeIn(); })); } $(function(){ tab(".tab1-nav ul",".tab1-con","on","mouseover"); }); /*Vendors*/ $(function(){ $('.sidebar').hover(function(){ $(this).find('span').addClass("on"); $(this).find('.sidenav').slideDown(); },function(){ $(this).find('.sidenav').hide(); $(this).find('span').removeClass("on"); }) }) /*mainnav*/ $(function(){ $(".navsub").hover(function(){ $(this).find('a').addClass("on"); $(this).find('.subnav').show(); },function(){ $(this).find('.subnav').hide(); $(this).find('a').removeClass("on"); }) }) /*invoice*/ $(function(){ $('#invoice').click(function(){ $(this).parents().find('.invoicecon').slideDown(); }),$(".close").click(function(){ $(this).parents().find('.invoicecon').hide(); }) }); $(function(){ var $this = $(".reviewcons"); var scrollTimer; $this.hover(function(){ clearInterval(scrollTimer); },function(){ scrollTimer = setInterval(function(){ scrollNews( $this ); }, 3000 ); }).trigger("mouseleave"); }); function scrollNews(obj){ var $self = obj.find("ul:first"); var lineHeight = $self.find("li:first").height(); //获取行高 $self.animate({ "marginTop" : -lineHeight +"px" }, 600 , function(){ $self.css({marginTop:0}).find("li:first").appendTo($self); //appendTo能直接移动元素 }) }