$(function () { $(".search_screen h3").text("鎼滄偍鎯虫壘鐨?) $(".wp-search .search-input input.search-title").attr("autocomplete","off") $(".wp-search .search-btn input.search-submit").attr("value","鎼滅储") $(".opensearch").mouseenter(function(){ $(".search_screen").addClass("active") $("body").addClass("showsearch") }) $(".header .close").click(function(){ $(".search_screen").removeClass("active") $("body").removeClass("showsearch") }) // $(".nav .wp-menu .menu-item").hover(function(){ // $(this).children("ul").stop().slideDown() // },function(){ // $(this).children("ul").stop().slideUp() // }) $(".returnTop").click(function () { $("html, body").animate( { scrollTop: 0, }, "slow" ); }); $(".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; }); if (window.innerWidth < 1000) { $("#footer .foot-center .links").click(function () { $(this).find(".news_list").slideToggle(); $(this).toggleClass("arrow"); }); } var imgItem = $(".main6 .bg img"); imgItem.attr("src", $(".post-61 .news_list .links").eq(0).attr("img-src")); $(".post-61 .news_list .links").hover(function () { $(this).addClass("active").siblings().removeClass("active"); imgItem.attr("src", $(this).attr("img-src")); }); }); fontSize(); $(window).resize(function () { fontSize(); }); function fontSize() { var size; var winW = window.innerWidth; $("body").removeClass("mobile"); if (winW <= 3800 && winW > 1024) { size = Math.round(winW / 19.2); } else if (winW <= 1024) { $("body").addClass("mobile"); size = 65; } $("html").css({ "font-size": size + "px", }); } //鑾峰彇x澶╁墠鐨勬棩鏈 function getDaysAgo(days) { const date = new Date(); date.setDate(date.getDate() - days); var month=new Date(date).getMonth()<9?'0'+(new Date(date).getMonth()*1+1):new Date(date).getMonth()*1+1; var day=new Date(date).getDate()<10?'0'+new Date(date).getDate():new Date(date).getDate() return new Date(date).getFullYear()+"-"+month+"-"+day; }