$(function(){ $("a").focus(function(){this.blur();}); $(".mainnav li").each(function (i, n) { if ($(this).find(".navpull dd").length == 0) { $(this).find(".arr").hide(); $(this).find(".navpull").addclass("null"); } }); // $(".openbtn").click(function(){ $(this).toggleclass("on"); $(".mobilenav").slidetoggle(); $(".mstbg").slidetoggle(); $("body").toggleclass("bodyon"); $(".closebtn").slidetoggle(1000); }); // $(".closebtn").click(function(){ $(".openbtn").toggleclass("on"); $(".mobilenav").slidetoggle(); $(".mstbg").slidetoggle(0); $("body").toggleclass("bodyon"); $(".closebtn").slidetoggle(0); }); // $(".searchbox .icon").click(function(){ $(".search").show(); }); $(".search .close").click(function(){ $(".search").hide(); }); // $(window).scroll(function() { if($(window).scrolltop()>=100){ $(".header").addclass("fixedhead"); }else{ $(".header").removeclass("fixedhead"); } }); // $(".videolist li .openplay").click(function(){ $(".subpage").css({"z-index":"999"}); }); $(".videopop .close").click(function(){ $(".subpage").css({"z-index":"1"}); }); // var targetheight = $(".leftbar").offset().top; // $(window).scroll(function(){ // slidein($(".leftbar"),0); // }); function slidein(obj){ var scrolltop = $(this).scrolltop(); if(scrolltop>targetheight-0){ obj.addclass("fixleft"); }else if(scrolltop offset ) ? $back_to_top.addclass('cd-is-visible') : $back_to_top.removeclass('cd-is-visible'); }); $back_to_top.on('click', function(event){ event.preventdefault(); $('body,html').animate({ scrolltop: 0 , }, scroll_top_duration ); });//返回顶部 }); //nav s $(".pcnav li").hover( function(){ $(".pcnav .navpull").hide(); $(".pcnav li span .sele").attr("class","shutahover"); $(this).attr("id","nav_hover") $("#nav_hover span a").attr("class","sele"); $("#nav_hover").find(".navpull").stop(true,true).slidedown(); }, function(){ if($(this).attr("class") != "nav_lishw"){ $("#nav_hover span .sele").attr("class",""); $("#nav_hover .navpull").stop(true,true).slideup(); } $(this).attr("id","") $(".pcnav li span .shutahover").attr("class","sele"); $(".nav_lishw").find(".navpull").attr(); $(".nav_lishw span a").attr("class","sele"); } ); $(".mobilenav li").each(function(){ var btn = $(this).find(".arr"); btn.click(function(){ var statis = $(this).parents("li").find(".navpull").css("display"); if(statis == "none"){ $(this).parents("li").siblings().removeclass("onnav"); $(this).parents("li").siblings().find(".navpull").slideup(); $(this).parents("li").addclass("onnav"); $(this).parents("li").find(".navpull").slidedown(); } else{ $(this).parents("li").find(".navpull").slideup(); $(this).parents("li").removeclass("onnav"); } }); }); //头部nav end //jquery start $(function(){ let gg = $(".msg").html(); console.log(gg); if(gg.indexof("span").on('click',function(){ $(".msg").hide(); }); $(".pcnav>ul>li>span>a").each(function () { if ($(this).attr('id')==$(".pid").attr('id') && $(".pid").attr('id') != '') { $(this).parents("li").addclass("onnav"); } if ((location.href + '/').indexof("/index.html") > -1 ) { $("#nav1").addclass("onnav"); } }); // $('a[href*=#]').click(function() { // if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) { // var $target = $(this.hash); // $target = $target.length && $target || $('[name=' + this.hash.slice(1) + ']'); // if ($target.length) { // var targetoffset = $target.offset().top; // $('html,body').animate({ // scrolltop: targetoffset // }, // 1000); // return false; // } // } // }); }); //jquery end