$(function () { bindAll(); autoPlayViedo(); navState(); bindCustomer(); addDownCount(); }); var curSelChildeMenu = ""; var curShowSidbarDetail = ""; var curSelCaseLi = null; var searchbar_show = false; function bindAll() { showBackTop(); $("body").on("mouseover", function () { $(".menu-child[data-rel='" + curSelChildeMenu + "']").fadeOut(200); $(".menu-child[data-rel='" + curSelChildeMenu + "']").css("margin-top", $(".menu-child[data-rel='" + curSelChildeMenu + "']").height() * -1 + "px"); $(".main-head li").removeClass("menu-over"); curSelChildeMenu = 0; //收回搜索框 2018年5月24日 if (searchbar_show) { $(".head-search-bar").slideUp("fast"); searchbar_show = false; var data_src = $(this).attr("data-src"); $(this).attr({ src: data_src }); } }); $(window).on("scroll", function () { showBackTop(); }); //头部菜单 var tirgger = null; $(".main-head li").on("mouseover", function (event) { if (tirgger!=null) { clearTimeout(tirgger); } event.stopPropagation(); var rel = $(this).attr("data-rel"); tirgger = setTimeout(function () { if (curSelChildeMenu != rel) { //$(".menu-child[data-rel='" + curSelChildeMenu + "']").fadeOut(300); var tempObj = $(".menu-child[data-rel='" + curSelChildeMenu + "']"); tempObj.css("margin-top", $(".menu-child[data-rel='" + curSelChildeMenu + "']").height() * -1 + "px"); tempObj.hide(); $(".main-head li").removeClass("menu-over"); curSelChildeMenu = rel; if ($(".menu-child[data-rel='" + rel + "']").length > 0) { $(".menu-child[data-rel='" + rel + "']").fadeIn(200); $(".menu-child[data-rel='" + rel + "']").css("margin-top", "0px"); } } },500); }); $(".menu-child li a").on("mouseover", function () { var replaceImgSrc = $(this).find("img").attr("data-replace-src"); $(this).find("img").attr("src", replaceImgSrc); }); $(".menu-child li a").on("mouseout", function () { var imgSrc = $(this).find("img").attr("data-src"); $(this).find("img").attr("src", imgSrc); }); $(".head-area").on("mouseover", function (event) { event.stopPropagation(); }); $(".menu-child").on("mouseover", function (event) { event.stopPropagation(); var rel = $(this).attr("data-rel"); $(".main-head li[data-rel='" + rel + "']").addClass("menu-over"); }); //$("#head_search").on("click", function () { // if (!searchbar_show) { // $(".head-search-bar").slideDown("fast"); // searchbar_show = true; // } // else { // $(".head-search-bar").slideUp("fast"); // searchbar_show = false; // } //}); //搜索框脚本 2018年5月8日 $("#head_search img").on("mouseover", function () { var data_replace_src = $(this).attr("data-replace-src"); $(this).attr({ src: data_replace_src }); if(!searchbar_show){ $(".head-search-bar").slideDown("fast"); searchbar_show = true; } if (tirgger != null) { clearTimeout(tirgger); } var tempObj = $(".menu-child[data-rel='" + curSelChildeMenu + "']"); tempObj.css("margin-top", $(".menu-child[data-rel='" + curSelChildeMenu + "']").height() * -1 + "px"); tempObj.hide(); curSelChildeMenu = 0; }); //$("#head_search img").on("click", function () { // if (searchbar_show) { // $(".head-search-bar").slideUp("fast"); // searchbar_show = false; // var data_src = $(this).attr("data-src"); // $(this).attr({ src: data_src }); // } //}); var keyword = $("#keyword").val(); if (keyword != undefined) { if (keyword.length > 0) { $("#keywords").val(keyword); } } //搜索结果关键字加红 2018年5月24日 $(".search_title").each(function () { var title = $(this).text(); var replace_keyword = ""+keyword+""; title = title.replace(keyword, replace_keyword); $(this).html("

"+title+"

"); }); //侧边栏脚本 $(".sidebar li").on("mousemove", function () { $(this).addClass("on"); //event.stopPropagation(); var replaceImgSrc = $(this).find("img").attr("data-replace-src"); $($(this).find("img")[0]).attr("src", replaceImgSrc); //var dataRel = $(this).attr("data-rel"); //if (curShowSidbarDetail != dataRel) { // $(".sidebar-detail").hide(); //} //curShowSidbarDetail = dataRel; //var left = $(this).offset().left - 245; //var top = $(this).offset().top; //$(".sidebar-detail[data-rel='" + dataRel + "']").css("left", left + "px").css("top", top + "px").show(); //console.log(dataRel + "length=" + $(".sidebar-detail[data-rel='" + dataRel + "']").length); }); $(".sidebar li").on("mouseout", function () { $(this).removeClass("on"); var curImgSrc = $(this).find("img").attr("data-src"); $($(this).find("img")[0]).attr("src", curImgSrc); }); $(".sidebar-detail").on("mousemove", function () { event.stopPropagation(); var classStr = $(this).parent().attr("class"); if (classStr.indexOf("on") == -1) { $(this).parent().addClass("on"); var replaceImgSrc = $(this).parent().find("img").attr("data-replace-src"); $($(this).parent().find("img")[0]).attr("src", replaceImgSrc); } }); //客服中心左侧QQ群脚本 $(".qq-group-icon").on("mouseover", function () { $(this).parent().addClass("on"); }); $(".qq-group-icon").on("mouseout", function () { $(this).parent().removeClass("on"); }); $(".qq-group-detail").on("mouseover", function (e) { e.stopPropagation(); $(this).parent().addClass("on"); }); $(".qq-group-detail").on("mouseout", function () { $(this).parent().removeClass("on"); }); //产品子菜单脚本 $(".menu-product-category li").mousemove(function (e) { $(".menu-product-category li").removeClass("menu-product-category-sel"); $(this).addClass("menu-product-category-sel"); var dataRel = $(this).attr("data-rel"); var dataUrl = $(this).attr("data-more-url"); $(".menu-product-list ul").hide(); $(".menu-product-list ul[data-rel='" + dataRel + "']").show(); $(".menu-product-list-more a").attr("href", dataUrl); }); $(".sidebar-backtop").on("click", function () { $("html,body").scrollTop(0); // $(document.body).scrollTop(0); }); curSelCaseLi = $(".index-case-list li")[0]; //新闻中心脚本 $(".index-news-category span a").on("mouseover", function () { $(".index-news-category span").removeClass("on"); $(this).parent("span").addClass("on"); var rel = $(this).parent("span").attr("data-rel"); $(".index-news ul").hide(); $(".index-news ul[data-rel='" + rel + "']").show(); }); $(".index-case-list li").on("click", function () { $(".index-case-list li").removeClass("index-case-list-sel"); curSelCaseLi = this; $(this).addClass("index-case-list-sel"); var dataRel = $(this).attr("data-rel"); $(".index-case-big-mid").css("display", "none"); $(".index-case-big-mid[data-rel='" + dataRel + "']").fadeTo(300, 1); }); $(".index-case-big-left").on("click", function () { var preli = $(curSelCaseLi).prev("li"); if (preli.length == 0) { preli = $(".index-case-list li:last"); } $(".index-case-list li").removeClass("index-case-list-sel"); curSelCaseLi = preli; $(preli).addClass("index-case-list-sel"); var dataRel = $(preli).attr("data-rel"); $(".index-case-big-mid").css("display", "none"); $(".index-case-big-mid[data-rel='" + dataRel + "']").fadeTo(300, 1); }); $(".index-case-big-right").on("click", function () { var nextli = $(curSelCaseLi).next("li"); if (nextli.length == 0) { nextli = $(".index-case-list li:first"); } $(".index-case-list li").removeClass("index-case-list-sel"); curSelCaseLi = nextli; $(nextli).addClass("index-case-list-sel"); var dataRel = $(nextli).attr("data-rel"); $(".index-case-big-mid").css("display", "none"); $(".index-case-big-mid[data-rel='" + dataRel + "']").fadeTo(300, 1); }); $(".index-cpfw-menu a").on("mouseover", function () { $(".index-cpfw-menu a").removeClass("index-cpfw-menu-sel"); $(this).addClass("index-cpfw-menu-sel"); var rel = $(this).attr("data-rel"); $(".index-cpfw-item").hide(); $(".index-cpfw-item[data-rel='" + rel + "']").show(); }); $(".index-cpfw-chanpin ul li").on("mouseover", function () { $(".index-cpfw-chanpin ul li").removeClass("on"); $(this).addClass("on"); }); $(".index-cpfw-chanpin ul li").on("mouseout", function () { $(this).removeClass("on"); }); $(".index-cpfw-xitong-content-list li").on("mouseover", function () { $(".index-cpfw-xitong-content-list li").removeClass("on"); $(".index-cpfw-xitong-content-remark").hide(); var imglist = $(".index-cpfw-xitong-content-list li").find("img"); for (var i = 0; i < imglist.length; i++) { var rel = $(imglist[i]).attr("data-src"); $(imglist[i]).attr("src", rel); } $(this).addClass("on"); var rel = $(this).attr("data-rel"); var replace_rel = $(this).find("img").attr("data-replace-src"); $(this).find("img").attr("src", replace_rel); $(".index-cpfw-xitong-content-remark[data-rel='" + rel + "']").show(); }); $(".index-cpfw-jishufuwu-menu span").on("mouseover", function () { $(".index-cpfw-jishufuwu-menu span").removeClass("on"); $(this).addClass("on"); var rel = $(this).attr("data-rel"); $(".index-cpfw-jishufuwu-content").hide(); $(".index-cpfw-jishufuwu-content[data-rel='" + rel + "']").show(); }); } function showBackTop() { var scrollTop = $(window).scrollTop(); if (scrollTop > 20) { $(".sidebar-backtop").show(); $(".sidebar-backtop").prev().find(".sidebar-icon").removeClass("sidebar-end"); } else { $(".sidebar-backtop").hide(); $(".sidebar-backtop").prev().find(".sidebar-icon").addClass("sidebar-end"); } } //百度编辑器中的视频自动播放 function autoPlayViedo() { $("video").attr({ autoplay: "autoplay", preload: "" }); } //请您留言 submit function msgSubmit() { var article_name = ""; //留言来源(下载的软件或直接留言) if ($("#count_name").val() != "") { // article_name = $("#article_name").val(); article_name = $("#count_name").val(); } else { article_name = "直接留言"; } var url = $("#url").val(); var paramObj = new Object(); paramObj.action = $("#action").val(); paramObj.article_name = article_name; paramObj.article_id = $("#article_id").val(); paramObj.realname = $("#txtRealName").val(); paramObj.sex = $("#txtSex").val(); paramObj.telephone = $("#txtTelephone").val(); paramObj.company = $("#txtCompany").val(); paramObj.address = $("#txtAddress").val(); paramObj.postalcode = $("#txtPostalcode").val(); paramObj.email = $("#txtEmail").val(); paramObj.msg = $("#txtMsg").val(); $.post(url, paramObj, function (o) { o = JSON.parse(o); if (o.status == 1) { var d = dialog(o.msg).show(); setTimeout(function () { d.close().remove(); if ($("#article_id").val() != "") { location.href = $("#returnurl").val(); } else { location.href = $("#indexurl").val(); } }, 2000); } if (o.status == 0) { var d = dialog(o.msg).show(); setTimeout(function () { d.close().remove(); }, 2000); } }); } //导航栏频道的选中状态 function navState() { var navRemark = $("#nav-remark").val(); $("li").removeClass("menu-sel"); $("#" + navRemark).addClass("menu-sel"); } //客服中心--绑定服务专区 2018年3月5日 function bindCustomer() { $(".service-list-detail").hide(); $(".content-area").on("click", ".area-list-item", function () { $(this).addClass("down"); $(this).css({ "background-color": "#0168B7", "color": "#FFFFFD" }); $(this).find(".glyphicon").css({ "color": "#F7F7F7" }); // $(".area-list-item .glyphicon").css({ "color": "#F7F7F7" }); var rel = $(this).attr("data-rel"); var _this = this; $(this).find(".glyphicon").removeClass("glyphicon-chevron-up").addClass("glyphicon-chevron-down"); $(".service-list-detail[data-rel='" + rel + "']").slideDown("fast"); }); $(".content-area").on("click", ".down", function () { $(this).removeClass("down"); $(this).css({ "background-color": "#F7F7F7", "color": "#333" }); $(this).find(".glyphicon").css({ "color": "#0168B7" }); // $(".area-list-item .glyphicon").css({ "color": "#0168B7" }); var rel = $(this).attr("data-rel"); var _this = this; $(this).find(".glyphicon").removeClass("glyphicon-chevron-down").addClass("glyphicon-chevron-up"); $(".service-list-detail[data-rel='" + rel + "']").slideUp("fast"); }); } //点击a标签增加下载数量 function addDownCount() { $(".down-content a").on("click", function () { var down_name = $(this).attr("title"); var url = $("#url").val(); var paramObj = new Object(); paramObj.action = $("#action").val(); paramObj.down_name = down_name; $.post(url, paramObj, function (o) { o = JSON.parse(o); if (o.status==1) { } if (o.status==0) { } }); }); } //搜索查询 function SiteSearch(send_url, divTgs) { var str = $.trim($(divTgs).val()); if (str.length > 0 && str != "输入关键字") { location.href = send_url + "?keyword=" + encodeURI($(divTgs).val()); } return false; }