You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.1 KiB

7 years ago
  1. $(document).ready(function(){
  2. //返回顶部
  3. $("#gototop").click(function(){
  4. $("html,body").animate({scrollTop :0}, 800);return false;
  5. });
  6. $("#gotocate").click(function(){
  7. $("html,body").animate({scrollTop:$("#categories").offset().top},800);return false;
  8. });
  9. // 搜索
  10. $("#small_search").click(function(){
  11. $("#topsearch").slideToggle();
  12. });
  13. if($(window).width()>768){
  14. //鼠标划过就展开子菜单
  15. $('ul.nav li.dropdown').hover(function() {
  16. $(this).find('.dropdown-menu').stop(true, true).slideDown();
  17. }, function() {
  18. $(this).find('.dropdown-menu').stop(true, true).slideUp();
  19. });
  20. //scrollTop
  21. // $(window).scroll(function(){
  22. // var scrolls = $(window).scrollTop()
  23. // if (scrolls > 10) {
  24. // $(".navbar").addClass("small-nav")
  25. // }else{
  26. // $(".navbar").removeClass("small-nav")
  27. // }
  28. // });
  29. }
  30. //左侧导航菜单
  31. // if ($("#firstpane .menu_body:eq(0)").text().replace(/[\r\n ]/g,"").length>0) {
  32. // $("#firstpane .menu_body:eq(0)").show().prev().html("-").prev().addClass("left_active");
  33. // };
  34. /* $("ul.menu_body").each(function(){
  35. if ($(this).text().replace(/[\r\n ]/g,"").length<=0) {$(this).prev().remove();} //去掉span
  36. });
  37. $("#firstpane span.menu_head").click(function(){
  38. var spanatt = $(this).next("ul.menu_body").css('display');
  39. if (spanatt == "block"){
  40. var spantext = "+";
  41. $(this).prev().removeClass("left_active");
  42. }else{
  43. var spantext = "-";
  44. $(this).prev().addClass("left_active");
  45. }
  46. $(this).html(spantext).addClass("current").next("ul.menu_body").slideToggle(300).siblings("ul.menu_body");
  47. });
  48. $(".left_nav#categories .left_nav_ul li").each(function(){
  49. if($(this).find("ul li").size()==0){
  50. $(this).find(".menu_head").remove();
  51. }
  52. }); */
  53. });