$(document).ready(function () { /*var lang = getCookie("language"); if (lang == null || lang == undefined || lang == "") { lang = "cn"; } var imgUrl = $(".icon-img").attr("src"); if (lang == "cn") { imgUrl = imgUrl.replace("En", "Cn"); } else { imgUrl = imgUrl.replace("Cn", "En"); } $(".icon-img").attr("src", imgUrl);*/ }); /*妫€娴嬫祻瑙堝櫒鏂规硶 ------------------------------------------------*/ var pageurl = window.location.search; if (pageurl == "?m2w") { addCookie("m2wcookie", "1", 0); } if (getCookie("m2wcookie") != "1" && browserRedirect()) { /*location.href = 'http://m.skyworth.com';*/ } /*宸ュ叿绫绘柟娉 ------------------------------------------------*/ //妫€娴嬫槸鍚︾Щ鍔ㄨ澶囨潵璁 function browserRedirect() { var sUserAgent = navigator.userAgent.toLowerCase(); var bIsIpad = sUserAgent.match(/ipad/i) == "ipad"; var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os"; var bIsMidp = sUserAgent.match(/midp/i) == "midp"; var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4"; var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb"; var bIsAndroid = sUserAgent.match(/android/i) == "android"; var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce"; var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile"; if ( bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM ) { return true; } else { return false; } } //鍐機ookie function addCookie(objName, objValue, objHours) { var str = objName + "=" + escape(objValue); if (objHours > 0) { //涓?鏃朵笉璁惧畾杩囨湡鏃堕棿锛屾祻瑙堝櫒鍏抽棴鏃禼ookie鑷姩娑堝け var date = new Date(); var ms = objHours * 3600 * 1000; date.setTime(date.getTime() + ms); str += "; expires=" + date.toGMTString(); } document.cookie = str; } //璇籆ookie function getCookie(objName) { //鑾峰彇鎸囧畾鍚嶇О鐨刢ookie鐨勫€ var arrStr = document.cookie.split("; "); for (var i = 0; i < arrStr.length; i++) { var temp = arrStr[i].split("="); if (temp[0] == objName) return unescape(temp[1]); } return ""; } /*姝e垯琛ㄨ揪寮忚幏鍙栧湴鍧€鏍忓弬鏁?/ function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; } /* //灏忓渾鍦堟悳绱over鏁堟灉 $(".search").hover(function() { $(".icon-img1").stop(); $(".icon-img1").fadeIn(); }, function() { $(".icon-img1").fadeOut(); }); $(".language").hover(function () { var lang = getCookie("language"); if (lang == null || lang == undefined || lang == "") { lang = "cn"; } if (lang == "cn") { $(".icon-img2").removeClass("en").removeClass("cn").addClass("cn"); } else { $(".icon-img2").removeClass("cn").removeClass("en").addClass("en"); } $(".icon-img2").stop(); $(".icon-img2").fadeIn(); }, function () { $(".icon-img2").fadeOut(); }); $(".language").find("a").click(function () { var me = $(this); var imgUrl = $(".icon-img").attr("src"); var lang = me.attr("data-lang"); if (lang == "cn") { imgUrl = imgUrl.replace("En", "Cn"); } else { imgUrl = imgUrl.replace("Cn", "En"); } $(".icon-img").attr("src", imgUrl); $(".icon-img2").fadeOut(); // 璁板綍Cookie addCookie("language", lang, 1); // 璺宠浆 }); */ //var search = $(".search"); // function seek(){ // $(".SS").slideToggle(600); // } // // search.on("click",seek); // // $(".SS-three").on("click",function(){ // $(".SS").slideUp(600); // }) $(".search").on("mouseenter", function () { $(".SS").stop().slideDown(600); $(this).children().addClass("current"); }); $(".search").on("mouseleave", function () { $(".SS").stop().slideUp(600); $(this).children().removeClass("current"); }); var isHide = true; $(".search").on("click", function () { if (isHide) { $(".SS").stop().slideDown(600); $(this).children().addClass("current"); isHide = false; } else { $(".SS").stop().slideUp(600); $(this).children().removeClass("current"); isHide = true; } }); $(".SS").on({ mouseover: function () { $(this).stop().slideDown(300); }, mouseleave: function () { $(this).stop().slideUp(600); }, }); $(".SS-three").on("click", function () { $(".SS").slideUp(600); }); //$(".search").hover(function(){ // $(".SS").slideDown(600); //},function(){ // $(".SS").slideUp(600); //}) //$(".SS").hover(function(){ // $(this).show(); //},function(){ // $(this).slideUp(600); //}) $(".SS-three").on("click", function () { $(".SS").slideUp(600); }); if (!browserRedirect()) { $("#wechat_show").on("mouseenter", function () { $("#wechat_qrcode").removeClass("hide").addClass("show"); }); $("#wechat_show").on("mouseleave", function () { $("#wechat_qrcode").removeClass("show").addClass("hide"); }); } else { $("#wechat_show").on("click", function () { if ($("#wechat_qrcode").hasClass("show")) { $(this).addClass("current"); $("#wechat_qrcode").removeClass("show").addClass("hide"); } else { $(this).removeClass("current"); $("#wechat_qrcode").removeClass("hide").addClass("show"); } }); $(document).on("click", function (e) { var e = e || window.event; //娴忚鍣ㄥ吋瀹规€ var elem = e.target || e.srcElement; if (elem.id && elem.id == "wechat_show") { } else { $("#wechat_show").addClass("current"); $("#wechat_qrcode").removeClass("show").addClass("hide"); } }); } var inMenu = false; if (!browserRedirect()) { // 闅愯棌瀵艰埅鏍忔晥鏋 // $(".navigation").hover(function(e) { // $(this).stop().slideDown(300); // }, function() { // $(this).stop().slideUp(500); // }); // $('.level').hover(function(e) { // // var targert = e.target || window.event.srcElement; // $(".navigation").stop().slideDown(500); // var liid = $(this).data('id'); // $('.nav-show').each(function(index) { // if (liid == index) { // $(this).show(); // } else { // $(this).hide(); // } // }); // }, function() { // $(".navigation").stop().slideUp(500); // }); // 鏂规硶2 $(".navigation").hover( function (e) { inMenu = true; }, function () { inMenu = false; $(".navigation").removeClass("animate__slideInDown"); $(".navigation").addClass("animate__slideOutUp"); } ); const hideSubMenu = () => { setTimeout(() => { if (!inMenu) { $(".navigation").addClass("animate__slideOutUp"); $(".navigation").remove("animate__slideInDown"); } }, 200); }; $(".cartoon").on("mouseenter", function (event) { event.stopPropagation(); var liid = $(this).data("id"); if (!liid && liid !== 0) { hideSubMenu(); return; } var navShows = $(".nav-show"); for (var i = 0; i < navShows.length; i++) { if (liid == i) { $(navShows[i]).show(); } else { $(navShows[i]).hide(); } } $(".navigation").removeClass("animate__slideOutUp"); $(".navigation").addClass("animate__slideInDown").show(); }); $(".navbar-nav").on("mouseleave", function (event) { hideSubMenu(); }); $(".conceal-four").hover(function () { $(".navigation").stop().slideUp(500); }); $(window).on("resize", function () { var winW = $(window).width(); console.log(winW); if (winW <= 1080) { $(".navigation").off("mouseenter").unbind("mouseleave"); $(".cartoon").off("mouseenter").unbind("mouseleave"); $(".conceal-four").off("mouseenter").unbind("mouseleave"); } }); $(".navigation").on("mouseover", "dd", function () { var that = $(this); var imgUrl = $(that).attr("data-img-url"); var imgObj = $(that) .parent() .parent() .siblings(".television-img") .find("img"); if (imgObj != null) { imgObj.attr("src", imgUrl); } }); } //$(".level").each(function(index,item){ // $(item).hover(function(){ // $(".Access").eq(index).show(); // },function(){ // $(".Access").eq(index).hide(); // }) //}) // //$(".Access").each(function(index,item){ // $(item).hover(function(){ // $(".Access").eq(index).show(); // },function(){ // $(".Access").eq(index).hide(); // }) //}) //function tab(btn,content){ // $(btn).on('mousemove',function(){ // var index=$(this).index(); // $(this).addClass('on').siblings().removeClass('on'); // $(content).eq(index).addClass('show').siblings().removeClass('show'); // }); //} //tab(".conceal-one",".television"); // if (browserRedirect()) { var isLinkHide = true; $(".member").on("click", function (event) { event.stopPropagation(); if (isLinkHide) { $(".ul").fadeIn(100); $(".jiantou").css({ transform: "rotate(45deg)", top: "25%" }); isLinkHide = false; } else { $(".ul").fadeOut(100); $(".jiantou").css({ transform: "rotate(-135deg)", top: "42%" }); isLinkHide = true; } }); $(document).on("click", function (event) { event.stopPropagation(); if ($(".ul").css("display") == "block") { $(".ul").fadeOut(100); $(".jiantou").css({ transform: "rotate(-135deg)", top: "42%" }); isLinkHide = true; } }); } else { //搴曢儴 $(".copyright-right").on("mouseenter", function (event) { event.stopPropagation(); $(".ul").fadeIn(100); $(".jiantou").css({ transform: "rotate(45deg)", top: "25%" }); }); $(".copyright-right").on("mouseleave", function () { event.stopPropagation(); $(".ul").fadeOut(100); $(".jiantou").css({ transform: "rotate(-135deg)", top: "42%" }); }); } // 搴曢儴璺宠浆鍒扮洿钀ュ簵鐨勯摼鎺ョ殑JS var shopLink = { 0: "shop.php?0", 1: "shop.php?1", 2: "shop.php?2", 3: "shop.php?3", }; $(".jump_to_shop").each(function (index, elem) { jumpToShop(index); }); function jumpToShop(index) { $(".jump_to_shop") .eq(index) .on("click", function () { if (window.location.href.indexOf("shop") != -1) { //console.log(window.location.href.indexOf("shop")); shopFunction.navShow( ".content_nav", "span", index, "checked", ".content_main_items" ); shopFunction.scrollToContent(); } else { window.location.href = shopLink[index]; //console.log(shopLink[index]) $(window).scrollTop(1200); //console.log("myscroll"); } }); } //鎼滅储鏌ヨ function SiteSearch(send_url, divTgs) { var str = $.trim($(divTgs).val()); if (str.length > 0 && str != "杈撳叆鍏冲仴瀛?) { window.location.href = send_url + "?keyword=" + encodeURI($(divTgs).val()); } return false; } function commonHttp(url, method, data, success) { $.ajax({ // url: "http://webapi.skyworth.com/api/" + url, url: "https://webapi.skyworth.com/api/" + url, type: method || "get", data: data, dataType: "json", success: function (res) { success && success(res); }, }); } function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } return false; } // 鏃堕棿鏍煎紡杞崲 function timestampFormat(timestamp) { function zeroize(num) { return (String(num).length == 1 ? "0" : "") + num; } var curTimestamp = parseInt(new Date().getTime() / 1000); //褰撳墠鏃堕棿鎴 var timestampDiff = curTimestamp - timestamp; // 鍙傛暟鏃堕棿鎴充笌褰撳墠鏃堕棿鎴崇浉宸鏁 var curDate = new Date(curTimestamp * 1000); // 褰撳墠鏃堕棿鏃ユ湡瀵硅薄 var tmDate = new Date(timestamp * 1000); // 鍙傛暟鏃堕棿鎴宠浆鎹㈡垚鐨勬棩鏈熷璞 var Y = tmDate.getFullYear(), m = tmDate.getMonth() + 1, d = tmDate.getDate(); var H = tmDate.getHours(), i = tmDate.getMinutes(), s = tmDate.getSeconds(); if (timestampDiff < 60) { // 涓€鍒嗛挓浠ュ唴 return "鍒氬垰"; } else if (timestampDiff < 3600) { // 涓€灏忔椂鍓嶄箣鍐 return Math.floor(timestampDiff / 60) + "鍒嗛挓鍓?; } else if ( curDate.getFullYear() == Y && curDate.getMonth() + 1 == m && curDate.getDate() == d ) { return "浠婂ぉ" + zeroize(H) + ":" + zeroize(i); } else { var newDate = new Date((curTimestamp - 86400) * 1000); // 鍙傛暟涓殑鏃堕棿鎴冲姞涓€澶╄浆鎹㈡垚鐨勬棩鏈熷璞 if ( newDate.getFullYear() == Y && newDate.getMonth() + 1 == m && newDate.getDate() == d ) { return "鏄ㄥぉ" + zeroize(H) + ":" + zeroize(i); } else if (curDate.getFullYear() == Y) { return ( zeroize(m) + "鏈? + zeroize(d) + "鏃 " + zeroize(H) + ":" + zeroize(i) ); } else { return ( Y + "骞? + zeroize(m) + "鏈? + zeroize(d) + "鏃 " + zeroize(H) + ":" + zeroize(i) ); } } }