$(function () { $('#xunpantext').hover(function() { var xunpantext = $(this).data('tiptitle'); $('#xunpantip').css({ top: $(this).outerheight(true) + 10 + 'px' }) $('#xunpantip').text(xunpantext) $('#xunpantip').addclass('xunpantextactive') }, function () { $('#xunpantip').removeclass('xunpantextactive') }) }) //导航// $('.secleft').each(function(){ $(this).find('a:gt(5)').remove(); }) $('.nav > li').hover(function(){ var sec_count = $(this).find('.sec a').length; var a_height = $(this).find('.sec a').eq(0).height(); var sec_height = sec_count * a_height; var sec_right = $(this).find('.secright').outerheight(true); if( $(this).find('.secleft').children().length > 0){ if(sec_height > sec_right){ $(this).find('.sec').stop().animate({height:sec_height},"slow"); $(this).find('.secleft').addclass('rbd'); }else{ $(this).find('.sec').stop().animate({height:sec_right},"slow"); $(this).find('.secright').addclass('lbd'); } } },function(){ $(this).find('.sec').stop().animate({height:0},"slow"); }); $('.nav > li.pro').hover(function(){ if($(this).find('.secs').children().length>0){ $(this).find('a:eq(0)').addclass('non'); $(this).find('.secs').stop().animate({height:412},300); } },function(){ $(this).find('a:eq(0)').removeclass('non'); $(this).find('.secs').stop().animate({height:0},300); }); $('.secs li.nlayer1:gt(7)').remove(); $('.nlayer2').each(function(){ $(this).find('li:gt(3)').remove(); }) var nav_li = $(".top-nav > li"); var navline = $(".nav_line"); $(function(){ nav_li.hover(function(){ var index = $(this).index(); $(this).addclass("current"); navline.stop().animate({width: 980-index*nav_li.eq(index).width()},200); },function(){ $(this).removeclass("current"); $('.nav_line').stop().animate({width:"980px"},800); }); })