// 动画效果 new wow().init(); ieversion(); // 判断ie function ieversion() { var useragent = navigator.useragent; //取得浏览器的useragent字符串 var isie = useragent.indexof("compatible") > -1 && useragent.indexof("msie") > -1; //判断是否ie<11浏览器 var isedge = useragent.indexof("edge") > -1 && !isie; //判断是否ie的edge浏览器 var isie11 = useragent.indexof("trident") > -1 && useragent.indexof("rv:11.0") > -1; // document.body.style.opacity = 0; document.body.style.display = "none"; if (isie) { var reie = new regexp("msie (\\d+\\.\\d+);"); reie.test(useragent); var fieversion = parsefloat(regexp["$1"]); console.log(fieversion); if (fieversion == 7) { $("html").addclass("browsers"); } else if (fieversion == 8) { $("html").addclass("browsers"); } else if (fieversion == 9) { $("html").addclass("browsers"); } else if (fieversion == 10) { $("html").addclass("browsers"); return 10; } else { $("html").addclass("browsers"); } } else if (isedge) { // document.body.style.opacity = 1; document.body.style.display = "block"; return "edge"; //edge } else if (isie11) { // document.body.style.opacity = 1; document.body.style.display = "block"; return 11; //ie11 } else { // document.body.style.opacity = 1; document.body.style.display = "block"; return -1; //不是ie浏览器 } } // 一个参数 function ajax(url, id) { var ajax = $.ajax({ url: url, async: false, type: "post", data: { id: id, }, }); $("#list-ajax").html(ajax.responsetext); } // 两个参数 function ajaxdoub(url, id, id2) { var ajax = $.ajax({ url: url, async: false, type: "post", data: { id: id, id2: id2, }, }); $("#list-show").html(ajax.responsetext); } function ajaxschool(url, id, id2, id3, val) { var ajax = $.ajax({ url: url, async: false, type: "post", data: { id: id, id2: id2, id3: id3, val: val, }, }); $("#list-show").html(ajax.responsetext); } // 带搜索 function ajaxsearch(url, val) { var ajax = $.ajax({ url: url, async: false, type: "post", data: { val: val, }, }); $("#list-show").html(ajax.responsetext); } // 带搜索 function ajaxval(url, id, val) { var ajax = $.ajax({ url: url, async: false, type: "post", data: { id: id, val: val, }, }); $("#list-ajax").html(ajax.responsetext); } // 分页 function page(url, sum) { p += 1; var ajax = $.ajax({ url: url, type: "post", data: { page: p, }, cache: false, datatype: "html", beforesend: function () {}, success: function (html) { $("#page-box").append(html); }, }); if (p == sum - 1) { $(".page-btn").hide(); } return false; } // 一个参数的搜索 function pagetab(url, id, sum) { $("#page-box").fadein(3000); p += 1; var ajax = $.ajax({ url: newurl, type: "post", data: { page: p, id: id, }, cache: false, datatype: "html", beforesend: function () {}, success: function (html) { $("#page-box").append(html); }, }); if (p == sum - 1) { $(".page-btn").hide(); } return false; } // 滚动效果 function scroll(num) { $("html,body") .stop() .animate({ scrolltop: $("#list-box").offset().top - num }, 800); } function scrolla(num, time) { $("html,body").animate( { scrolltop: $($(this).attr("href")).offset().top - num, }, time ); } // 头部定位 function nav(num) { $(".head-nav .nav-ls").eq(num).addclass("cur"); // $(".nav-container .swiper-slide").eq(num2).addclass("cur"); } // 返回顶部 function gototop(minheight) { $(".back-top").click(function () { $("html,body").animate( { scrolltop: "0px", }, "slow" ); }); minheight ? (minheight = minheight) : (minheight = 600); $(window).scroll(function () { var s = $(window).scrolltop(); if (s > minheight) { $(".back-top").fadein(500); } else { $(".back-top").fadeout(500); } }); } function scrolltabnav() { $(window).on("scroll resize", function () { wintop = $(window).scrolltop(); if ($(".side-box").length > 0) { var _length = $(".side-box").length; for (var i = 0; i < _length; i++) { if ( $(window).scrolltop() >= $(".side-box").eq(i).offset().top - $(".head").height() ) { $(".side-bar a").eq(i).addclass("cur").siblings().removeclass("cur"); } } } }); } $(function () { // let home = $("body").attr("data-idx"); // if (!home) { // // 获取二级栏目距离顶部距离 // let navtop = $(".nav-box").offset().top; // // 获取二级栏目高度 // let navheight = $(".nav-box").height(); // } // 获取头部高度 // let headheight = $(".head").height(); // 滚动高度 let widtop = 0; function scrollnav() { widtop = $(document).scrolltop(); // 头部悬浮 if (widtop >= 100) { $(".head").addclass("head-scroll"); } else { $(".head").removeclass("head-scroll"); } // if (!home) { // // 二级栏目悬浮 // if (widtop >= navtop - navheight - headheight) { // $(".pub-nav").addclass("nav-fix"); // } else { // $(".pub-nav").removeclass("nav-fix"); // } // } } scrollnav(); $(document).scroll(function () { scrollnav(); }); // 判断头部是否添加初始底色 let headbgidx = $("body").attr("data-bg"); if (headbgidx == 1) { $(".head-box").addclass("inithead"); $(".head").addclass("head-scroll2"); } // 手机展开 $(".menu").click(function () { if ($(this).hasclass("cur")) { $(this).removeclass("cur"); $(".mb-head").slideup(); $(".head").removeclass("head-scroll"); $("body").removeclass("body"); $("html").removeclass("html"); } else { $(this).addclass("cur"); $(".mb-head").slidedown(); $(".head").addclass("head-scroll"); $("body").addclass("body"); $("html").addclass("html"); } }); // 二级栏目 $(".mb-nav").click(function () { if ($(this).hasclass("cur")) { $(this).removeclass("cur").find(".mb-nav-scd").slideup(); } else { if ($(this).find(".mb-nav-frs").attr("href") == "javascript:;") { $(this) .addclass("cur") .find(".mb-nav-scd") .slidedown() .parent() .siblings() .removeclass("cur") .find(".mb-nav-scd") .slideup(); } else { } } }); // 点击导航关闭 $(".mb-nav-scd a").click(function () { $(".mb-head").slideup(); $(".menu").removeclass("cur"); $("body").removeclass("body"); $("html").removeclass("html"); }); // pc二级下拉 $(".head-nav .nav-ls").hover( function () { $(this).find(".pos-nav").stop(true, false).slidedown(); }, function () { $(this).find(".pos-nav").stop(true, false).slideup(); } ); // 搜索 $(".head-search").click(function () { $(".search-dialog").addclass("search-dialog-slide"); }); // 关闭搜索 $(".search-dialog .form-box .close").click(function () { $(".search-dialog").removeclass("search-dialog-slide"); }); // 二级栏目 if ($("div").hasclass("nav-container")) { let navindex = $(".nav-container .swiper-slide.cur").index(); var navswiper = new swiper(".nav-container", { observer: true, observeparents: true, slidesperview: "auto", }); navswiper.slideto(navindex, 500, false); } // 链接展开 $(".footer .top .foot-logo .link p").click(function () { if ($(this).hasclass("cur")) { $(this) .removeclass("cur") .siblings(".change") .stop(true, false) .slideup(); } else { $(this).addclass("cur").siblings(".change").stop(true, false).slidedown(); } }); let closesrc = $(".videos_mask").attr("data-src"); // 播放视频 $(document).on("click", ".play", function (event) { event.preventdefault(); var video = $(this).attr("data-path"); //获取视频路径 $(".videos").html( '' ); $(".videos").fadein(); $(".videos_mask").fadein(); }); function close1() { var v = document.getelementbyid("video"); //获取视频节点 $(".videos").fadeout(); //点击关闭按钮关闭暂停视频 $(".videos_mask").fadeout(); //点击关闭按钮关闭暂停视频 v.pause(); $(".videos").html(); } // 关闭视频 $(".videos").on("click", ".vclose", function (event) { event.preventdefault(); close1(); }); });