$(function () { $(".nav .wp-menu .menu-item").hover(function(){ $(this).children("ul").slideDown() },function(){ $(this).children("ul").slideUp() }) $(".search-submit").click(function (event) { $(this).removeAttr("name"); event.preventDefault(); var val = $.trim($(".search-title").val()); if (val !== "") { $(".wp-search").find("form").submit(); } else { alert("璇疯緭鍏ュ叧閿瘝"); } return false; }); $(".returnTop").click(function () { $("html, body").animate( { scrollTop: 0, }, "slow" ); }); if (window.innerWidth< 1000) { $("#footer .foot-center .links").click(function () { $(this).find(".news_list").slideToggle(); $(this).toggleClass("arrow"); }); } //瀵艰埅缃《闅忛〉闈㈢Щ鍔 if($(window).width()> 767){ window.onscroll = function(){ var zhead = $(".header").height() + 5; //鑾峰彇澶撮儴楂樺害 var sTop = $(document).scrollTop(); //婊氬姩浜嬩欢 if( parseInt(sTop) > zhead){ //瑙﹀彂鏉′欢锛屽彲浣跨敤鏁板瓧 $('.navi').addClass('roll'); }else { $('.navi').removeClass('roll'); } if( parseInt(sTop) > zhead){ //瑙﹀彂鏉′欢锛屾樉绀鸿繑鍥為《閮ㄦ寜閽紝鍙娇鐢ㄦ暟瀛 $(".goTop").show(); }else { $(".goTop").fadeOut(800); } $(".goTop").on("click",function(){ //婊氬姩閫熷害 $("body,html").stop().animate({scrollTop:0}, 800); }); if(window.screen.width <= 768){ //鍒ゆ柇鍒嗚鲸鐜 $(".goTop").remove(); } } } }); fontSize(); $(window).resize(function () { fontSize(); }); function fontSize() { var size; var winW = window.innerWidth; $("body").removeClass("mobile"); if (winW <= 3800 && winW > 999) { size = Math.round(winW / 19.2); } else if (winW <= 999) { $("body").addClass("mobile"); size = 65; } $("html").css({ "font-size": size + "px", }); } $("a").each(function () { if ($(this).attr("href") != undefined) { if ($(this).attr("href").indexOf("/_s57") != -1 && $(this).attr("href").indexOf("_t882") == -1) { $(this).attr("href", $(this).attr("href").replace("/_s57", "/_s57/_t882")); } } });