$(function(){ navShow(); navFloat(); backTop(); $(".g-btn").click(function(){ var n = $(this).attr("data-num"); if(n==0){ $(".g-web-nav").show(); $(this).attr("data-num",1); $("#m-nav-hide").height(0).hide(); $("#m-nav-showbtn").removeClass("m-hover").attr("data-num",0); }else{ $(".g-web-nav").hide(); $(this).attr("data-num",0); } }); generalTab(); $(".g-ku-nav li").each(function(){ var navName = $(this).find("a").text(); if(main.pagename.indexOf(navName) != -1){ $(this).addClass("f-hover") } }) if($(".g-hot-video").length>0){ if($(".g-hot-video dd a").length<=0){ $(".g-hot-video").hide(); } } if($(".g-hot-cms").length>0){ if($(".g-hot-cms dd a").length<=0){ $(".g-hot-cms").hide(); } } if($(".g-hot-stategy").length>0){ if($(".g-hot-stategy dd a").length<=0){ $(".g-hot-stategy").hide(); } } if($(".g-downlist").length>0){ if($(".g-downlist dd a").length<=0){ $(".g-downlist").hide(); } } }) function navShow(){ $("#m-nav-hide").hide(); $("#m-nav-showbtn").click(function(){ var dataNum = $(this).attr("data-num") ; var nn = $("#m-nav-hide li").length; if(dataNum==0){ $("#m-nav-hide").show(); $(this).addClass("m-hover"); $("#m-nav-hide").stop().animate({height:nn*33},200); $(this).attr("data-num",1); }else{ $(this).removeClass("m-hover"); $("#m-nav-hide").stop().animate({height:0},200,function(){$("#m-nav-hide").hide();}); $(this).attr("data-num",0); } }); } function navFloat(){ $(window).scroll(function(){ if($(window).scrollTop()>100){ $(".g-nav").addClass("m-nav-float"); $("#owl-demo").css("margin-top",43); }else{ $(".g-nav").removeClass("m-nav-float"); $("#owl-demo").css("margin-top",2); } }); } function backTop(){ $(window).scroll(function(){ if($(window).scrollTop()>300){ $("#m-backtop").fadeIn("fast"); }else{ $("#m-backtop").fadeOut("fast"); } }); $("#m-backtop").click(function(){ $("html,body").animate({scrollTop:0},200) }); } function generalTab(){//ͨÓÃÑ¡Ï if($(".m-tab-box").length>0){ $(".m-tab-box").each(function(){ $(this).children(".m-tab-cont:gt(0)").hide(); $(this).find(".m-tab-btn li:first").addClass("m-hover"); }); $(".m-tab-cont").each(function(){ var childSize = $(this).children().length; if(childSize<=0){ var nAll = $(this).parents(".m-tab-box").find(".m-tab-cont:first").prevAll().length; var n = $(this).index(); $(this).parents(".m-tab-box").find(".m-tab-btn li").eq(n-nAll).hide(); } }); $(".m-tab-btn li").click(function(){ $(this).addClass("m-hover").siblings("li").removeClass("m-hover"); var n = $(this).index(); var tabSize = $(this).parents("div").find(".m-tab-box").length; if(tabSize == 0){ $(this).parents(".m-tab-box").find(".m-tab-cont").eq(n).show().siblings(".m-tab-cont").hide(); }else{ $(this).parent(".m-tab-btn").parent(".m-tab-box").children(".m-tab-cont").eq(n).show().siblings(".m-tab-cont").hide(); } }); } }