function include(url, target) { $.get(url, function(data) { $("#" + target).replaceWith(data); }); } // 鎶婁笅绾у鑸斁鍦ㄤ竴绾у鑸」鐨勬涓嬫柟锛堥櫎浜嗘渶鍚庝竴涓€滄槑鏄熶骇鍝佲€濓級 function centerNav() { $('.main-nav').attr('data-center', 1); $('.main-nav li.rootItem').each(function() { var offsetLeft = $(this).offset().left; var navItemWidth = $(this).outerWidth(); var subNavLeft = offsetLeft + navItemWidth / 2; $('> .sub-nav', $(this)).css({ paddingLeft: '0', paddingRight: '0', display: 'block', visibility: 'hidden', }); $('> .sub-nav > .wrapper', $(this)).css({ width: '100%', }); $('> .sub-nav > .wrapper > ul', $(this)).css({ position: 'absolute', display: 'block', left: subNavLeft, // marginLeft: $(this).hasClass('product') ? '-130px' : 0, // 鏈夊浘鏃 // marginLeft: $(this).hasClass('product') ? '-702px' : 0, // 鏃犲浘鏃 width: $(this).hasClass('product') ? ' 220px' : '', // 鏃犲浘鏃 }); // console.log($('> a', $(this)).text(), 'offsetLeft', offsetLeft, 'navItemWidth', navItemWidth, 'subNavLeft', subNavLeft, $('> .sub-nav ul', $(this)).outerWidth()); $('> .sub-nav', $(this)).css({ display: '', visibility: '', }); }); // console.log('centerNav()', window.innerWidth) } $(function() { if (window.innerWidth > 1024) { centerNav(); } $(window).resize(function() { if (window.innerWidth <= 1024 && $('.main-nav').attr('data-center') == 1) { // console.log("$('.main-nav').attr('data-center')", $('.main-nav').attr('data-center')) // 娓呴櫎 centerNav() 璁剧疆鐨勬牱寮 window.location.reload(); } else if (window.innerWidth > 1024) { centerNav(); } }); // 鍚戜笅婊氬姩鏃堕殣钘忓鑸潯銆佸悜涓婃粴鍔ㄦ椂鏄剧ず瀵艰埅鏉 var scrollTopLast = 0; window.onscroll = function(e) { if (window.innerWidth > 1024) { var scrollTop = e.target.scrollingElement.scrollTop; if (scrollTop > scrollTopLast) { // console.log("鍚戜笅婊氬姩") if (scrollTop > 80 && $('.header').is(':visible')) { $('.header').slideUp(200); } } else { // console.log("鍚戜笂婊氬姩") if (!$('.header').is(':visible')) { $('.header').slideDown(200); } } scrollTopLast = scrollTop; } } $(".show-main-nav, .main-nav .close").click(function() { $(".main-nav").toggleClass("active"); }); $(".apply-for-position").click(function() { var title = $(this).data("title") || ""; var jobId = $(this).data("id") || 0; layer.open({ title: "搴旇仒銆? + title + "銆?, type: 1, content: $(".apply-form"), shadeClose: false, // area: ["600px", "400px"], // closeBtn: 0, anim: 1, btn: ["搴旇仒", "鍙栨秷"], yes: function(index, dom) { var name = $('[name="name"]', dom).val(); var mobile = $('[name="mobile"]', dom).val(); var file = $('[name="file"]', dom).val(); var file = $('[name="file"]', dom).val(); // console.log("dom", name, mobile, file); if (name == "" || name.length < 2) { layer.msg("璇峰~鍐欏鍚?, { time: 1000, icon: 2 }); return false; } if (mobile.length != 11) { layer.msg("璇峰~鍐欐墜鏈哄彿", { time: 1000, icon: 2 }); return false; } if (file == "") { layer.msg("璇烽€夋嫨绠€鍘?, { time: 1000, icon: 2 }); return false; } // layer.close(index); //濡傛灉璁惧畾浜唝es鍥炶皟锛岄渶杩涜鎵嬪伐鍏抽棴 var loading = layer.load(); var form = new FormData(); form.append("id", jobId); form.append("name", name); form.append("mobile", mobile); form.append("file", $('[name="file"]', dom).get(0).files[0]); $.ajax({ cache: false, contentType: false, processData: false, // 鐢ㄤ簬瀵筪ata鍙傛暟杩涜搴忓垪鍖栧鐞 type: "POST", url: "job_apply.php", data: form, success: function(result) { // console.log("result", result); layer.open({ title: "鐢宠宸叉彁浜?, content: "璇蜂繚鎸佺數璇濈晠閫?, shadeClose: false, }); layer.close(index); layer.close(loading); }, error: function(res) { // console.log("鍑洪敊浜?, res); layer.close(loading, function() { layer.open({ title: "鍑洪敊浜?, content: res.responseText || res.status, shadeClose: true, }); }); }, }); }, }); }); $(".video-button").click(function() { var src = $(this).data("src"); var title = $(this).data("title"); if (src) { var dialog = layer.open({ skin: "video-player", title: title || "瑙嗛鎾斁鍣?, type: 1, closeBtn: 0, area: ["100%", "100%"], title: "", content: '\ X', shadeClose: true, // btnAlign: "c", // btn: ["纭畾", "鍙栨秷"], // yes: function (index, layero) {}, success: function(layero, index) { this.escQuit = function(event) { // console.log(event.keyCode); if (event.keyCode === 27) { $("#fullscreen-video").remove(); layer.closeAll("page"); return false; //闃绘绯荤粺榛樿鍥炶溅浜嬩欢 } }; $(document).on("keydown", this.escQuit); //鐩戝惉閿洏浜嬩欢 }, }); layer.full(dialog); // var video = document.createElement("video"); // video.setAttribute("id", "fullscreen-video"); // video.setAttribute("src", src); // video.setAttribute("autoplay", true); // video.setAttribute("controls", true); // document.body.appendChild(video); // if (video.RequestFullScreen) { // video.RequestFullScreen(); // } else if (video.mozRequestFullScreen) { // video.mozRequestFullScreen(); // } else if (video.webkitRequestFullScreen) { // video.webkitRequestFullScreen(); // } else if (video.msRequestFullscreen) { // video.msRequestFullscreen(); // } else { // console.log("褰撳墠娴忚鍣ㄤ笉鏀寔鍏ㄥ睆鎾斁"); // } } else { layer.msg("缂哄皯瑙嗛鏂囦欢URL", { time: 1000, icon: 2 }); console.warn("缂哄皯瑙嗛鏂囦欢URL"); } }); $(".b8 .tab li").click(function() { var idx = $(this).index(); var p = $(this).closest(".wrapper"); $(".content li", p).removeClass("active").eq(idx).addClass("active"); $(".tab li", p).removeClass("active").eq(idx).addClass("active"); }); $("a.no-file").attr("title", "娌℃湁鏂囦欢"); // 楂樹寒褰撳墠瀵艰埅椤 var urlParts = window.location.pathname.replace(/^\//, '').replace(/#.*/, '').split('-'); var location = { module: urlParts[0] || null, moduleId: urlParts[1] || null, }; $('.main-nav a').each(function(i) { var a = $(this); var hrefParts = a.attr('href').replace(/#.*/, '').split('-'); var href = { module: hrefParts[0] || null, moduleId: hrefParts[1] || null, }; var hit = location.module == href.module && location.moduleId == href.moduleId ? true : false; // console.log(window.location.pathname, a.attr('href'), hit); if (hit) { a.closest('.subItem').addClass('active'); a.closest('.rootItem ').addClass('active'); } }); });