/* * @descripttion: * @version: * @author: 闫旭 * @date: 2020-12-31 14:25:41 * @lasteditors: suerimn * @lastedittime: 2021-10-22 09:09:11 */ function handlelocalstorage(method, key, value) { switch (method) { case "get": { let temp = window.localstorage.getitem(key); if (temp) { return temp; } else { return false; } } case "set": { window.localstorage.setitem(key, value); break; } case "remove": { window.localstorage.removeitem(key); break; } default: { return false; } } } // 轮播图初始化函数 function initarrswiper(index) { if (index == 0) { index = ""; } new swiper(".swiper-container-intro" + index, { autoplay: 5000, //可选选项,自动滑动 loop: true, //可选选项,开启循环 // 如果需要前进后退按钮 navigation: { nextel: ".arrow-right", prevel: ".arrow-left", }, pagination: ".pagination-intro" + index, paginationclickable: true, }); } $(function () { // 循环初始化轮播图 for (var index = 0; index <= 3; index++) { initarrswiper(index); } //文字 两行剪切 $(".content > h4 > a").each(function () { var maxwidth = 160; if ($(this).text().length > maxwidth) { $(this).text($(this).text().substring(0, maxwidth)); $(this).html($(this).html() + "…"); } }); // tab切换 var $tab = $(".swiper ul li"); $tab.on("mouseenter", function () { var index = $(this).index(); $(this) .find("a") .addclass("cur") .parent() .siblings() .find("a") .removeclass("cur"); $(this) .find("div") .addclass("dis") .parent() .siblings() .find("div") .removeclass("dis"); $(this) .parents(".swiper") .siblings(".swiper_content") .find(".right_news") .addclass("undis") .eq(index) .removeclass("undis"); return false; }); // 产业布局 var introduction = true; var industry = $(".industry .energy ul li"); industry.on("mouseenter", function () { var index = $(this).index(); if (introduction) { $(".introduction").hide(); introduction = false; } $(this).find("div").css("font-size", "18px"); $(this).css({ background: "#00ce91", transform: "scale(1.1)", }); $(this).siblings().find("div").css("font-size", "16px"); $(this).siblings().css({ background: "rgba(0, 108, 255, 0.45)", transform: "scale(1)", }); $(this).find("img").addclass("route360"); $(this).siblings().find("img").removeclass("route360"); $(".energy_content") .not(".introduction") .addclass("undis") .eq(index) .removeclass("undis"); }); // 图片列表切换 var $tab1 = $(".swiper_list ul li"); $tab1.on("mouseenter", function () { var index = $(this).index(); $(this) .parents(".swiper") .siblings(".picture_list") .addclass("undis") .eq(index) .removeclass("undis"); return false; }); $(".left_big1").hover( function () { $(this).find("span").addclass("col_common"); }, function () { $(this).find("span").removeclass("col_common"); } ); // $.ajax({ // url: "http://nengyuan.chuangqi.34hy.cn/stock", // type: "get", // success: function (result) { // var res = json.parse(result); // console.log(res, "rrr"); // stocklist = res.data; // renderhtml(); // }, // }); // function renderhtml() { // if (!stocklist || stocklist.length === 0) { // stocklist = []; // return; // } // var htmlstr = template("getstock", { message: stocklist }); // $("#stock_list").html(htmlstr); // } // 首页访问量 // function addpv() { // $.ajax({ // url: "http://app.litenews.cn/pv/" + orgid + "/views", // type: "get", // success: function (res) { // var str = "当前访问量:" + res.data + "次"; // $(".footer_bottom .footer_bottom_inner >:nth-child(2)").text(str); // }, // }); // } // try { // addpv(); // } catch (error) { // console.log("2"); // } var ad1 = new admove("pc1", "close_btn"); ad1.run(); /** * @description: 2021/10/22 * @param {*} 判断飘窗是否有 * @return {*} */ $("#pc1").find("span").text() == "1" ? $("#pc1").show() : $("#pc1").hide(); function closecanvas(params) { $(".first_div").fadeout(); $("#canvas").fadeout(); } // 弹窗取消 $(".first_div .close_btn").click(function () { closecanvas(); }); // var firsrresult = handlelocalstorage("get", "_first"); // // if (!firsrresult) { // // handlelocalstorage("set", "_first", true); // // } else { // // $("#canvas").hide(); // // $(".first_div").hide(); // // } var canvas = settimeout(function () { closecanvas(); canvas = null; }, 5000); });