/*蓝科企业网站系统php版 http://www.lankecms.com*/ $(document).ready(function(){ //返回顶部 $("#gototop").click(function(){ $("html,body").animate({scrolltop :0}, 800);return false; }); $("#gotocate").click(function(){ $("html,body").animate({scrolltop:$("#categories").offset().top-50},800);return false; }); // 搜索 $("#small_search").click(function(){ $("#topsearch").slidetoggle(); }); //scrolltop $(window).scroll(function(){ var scrolls = $(window).scrolltop() if (scrolls > 10) { $(".navbar").addclass("small-nav"); $(".flash").addclass("toflash"); }else{ $(".navbar").removeclass("small-nav"); $(".flash").removeclass("toflash"); } }); if($(window).width()>768){ //鼠标划过就展开子菜单 $('ul.nav li.dropdown').hover(function() { $(this).find('.dropdown-menu').stop(true, true).slidedown(); }, function() { $(this).find('.dropdown-menu').stop(true, true).slideup(); }); } //左侧导航菜单 // if ($("#firstpane .menu_body:eq(0)").text().replace(/[\r\n ]/g,"").length>0) { // $("#firstpane .menu_body:eq(0)").show().prev().html("-").prev().addclass("left_active"); // }; $("ul.menu_body").each(function(){ if ($(this).text().replace(/[\r\n ]/g,"").length<=0) {$(this).prev().remove();} //去掉span }); $("#firstpane span.menu_head").click(function(){ var spanatt = $(this).next("ul.menu_body").css('display'); if (spanatt == "block"){ var spantext = "+"; $(this).prev().removeclass("left_active"); }else{ var spantext = "-"; $(this).prev().addclass("left_active"); } $(this).html(spantext).addclass("current").next("ul.menu_body").slidetoggle(300).siblings("ul.menu_body"); }); });