$(function(){ function menu(){ if($(window).width()>992){$(".navBoxm").hide();$(".menuBtn").removeClass("active");} } menu(); $(".navList .navSubLi h4").on("click",function(){ if($(this).parent().hasClass("active")){ $(this).parent().removeClass("active"); $(this).next(".navThrList").slideUp(); $(this).parent().find(".navFouList").slideUp(); }else{ $(this).parent().addClass("active"); $(this).next(".navThrList").slideDown(); } }) $(".navList .navThrLi h5").on("click",function(){ if($(this).parent().hasClass("active")){ $(this).parent().removeClass("active"); $(this).next(".navFouList").slideUp(); }else{ $(this).parent().addClass("active"); $(this).next(".navFouList").slideDown(); } }) $(".navList .navLi").hover(function(){ $(this).addClass("active"); $(this).find(".navSub").stop().slideDown(); },function(){ $(this).removeClass("active"); $(this).find(".navSub").stop().slideUp(); $(".navThrList").slideUp(); $(".navFouList").slideUp(); }) $(".navBoxm").append("<ul class='navListm navListm2'></ul>"); $(".navListm").html($(".navList").html()); $(".navSubLi").each(function(index, element) { if($(this).find(".navThrList").length>0){ $(this).addClass("has"); $(this).find("h4 a").attr("href","javascript:;"); } }); $(".navListm .navLi").each(function(index, element) { if($(this).find(".navSub").length>0){ $(this).addClass("has"); $(this).find("h3 a").attr("href","javascript:;"); } }); $(".navListm .navLi h3").on("click",function(){ if($(this).parent().hasClass("active")){ $(this).parent().removeClass("active"); $(this).next(".navSub").slideUp(); $(this).parent().find(".navFouList").slideUp(); }else{ $(".navListm .navLi").removeClass("active"); $(".navSub").slideUp(); $(".navThrList").slideUp(); $(".navFouList").slideUp(); $(this).parent().addClass("active"); $(this).next(".navSub").slideDown(); } }) $(window).on("click",function(){ $(".menuBtn").removeClass("active"); $(".navBoxm").slideUp(); }) $(".menuBtn").on("click",function(event){ $(this).toggleClass("active"); $(".navBoxm").slideToggle(); event.stopPropagation(); }) $(".navBoxm").on("click",function(event){ event.stopPropagation(); }) var lbtH = $(".lbt").height(); var transparentNum = 1; var topH = 0; $(window).scroll(function(){ topH = $(document).scrollTop(); //卷入的高度 if(lbtH >= topH){ transparentNum = (1-(lbtH - topH)/lbtH).toFixed(2); }else{ topH = lbtH; } // $(".bannerBox").css("background-color","rgba(51,51,51,"+transparentNum+")"); }); $(window).resize(function(){ menu(); }) })