// 鍔ㄧ敾鏁堟灉
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鐨凟dge娴忚鍣
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 ajaxPage(url) {
var ajax = $.ajax({
url: url,
async: false,
type: "POST",
data: {},
});
$("#list-ajax").html(ajax.responseText);
}
// 涓€涓弬鏁
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 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,
},
});
$(".ajax-search input").val("");
$("#list-ajax").html(ajax.responseText);
}
function ajaxJoin(url, id, id2, id3, val) {
var ajax = $.ajax({
url: url,
async: false,
type: "POST",
data: {
id: id,
id2: id2,
id3: id3,
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) {
$(".page-btn").hide();
}
return false;
}
// 涓€涓弬鏁扮殑鎼滅储
function pageTab(url, id, sum) {
$("#page-box").fadeIn(3000);
p += 1;
var ajax = $.ajax({
url: url,
type: "POST",
data: {
page: p,
id: id,
},
cache: false,
dataType: "html",
beforeSend: function () {},
success: function (html) {
$("#page-box").append(html);
},
});
if (p >= sum) {
$(".page-btn").hide();
}
return false;
}
function pageJoin(url, id, id2, id3, val, sum) {
p += 1;
var ajax = $.ajax({
url: url,
type: "POST",
data: {
page: p,
id: id,
id2: id2,
id3: id3,
val: val,
},
cache: false,
dataType: "html",
beforeSend: function () {},
success: function (html) {
$("#list-ajax").append(html);
},
});
if (p >= sum) {
$(".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, num2) {
$(".head-nav .nav-ls").eq(num).addClass("cur");
$(".nav-container .swiper-slide").eq(num2).addClass("cur");
}
gotoTop();
// 杩斿洖椤堕儴
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 () {
var agent = navigator.userAgent;
if (/.*Firefox.*/.test(agent)) {
document.addEventListener("DOMMouseScroll", function(e) {
e = e || window.event;
var detail = e.detail;
if (detail > 0) {
$(".head").addClass("head-scroll head-scroll-active");
// console.log("榧犳爣鍚戜笅婊氬姩");
} else {
$(".head").removeClass("head-scroll-active");
// console.warn("榧犳爣鍚戜笂婊氬姩");
}
});
} else {
document.onmousewheel = function(e) {
e = e || window.event;
var wheelDelta = e.wheelDelta;
if (wheelDelta > 0) {
$(".head").removeClass("head-scroll-active");
// console.log("榧犳爣鍚戜笂婊氬姩");
} else {
$(".head").addClass("head-scroll head-scroll-active");
// console.warn("榧犳爣鍚戜笅婊氬姩");
}
}
}
// 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 head-scroll-active");
}
// 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-scroll2");
$("body").removeClass("body");
$("html").removeClass("html");
} else {
$(this).addClass("cur");
$(".mb-head").slideDown();
$(".head").addClass("head-scroll2");
$("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-box .head").hover(
function () {
$(this).addClass("head-scroll3");
},
function () {
$(this).removeClass("head-scroll3");
}
);
// 鎼滅储
$(".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);
}
// 閾炬帴灞曞紑
$(".foot-url p").click(function () {
if ($(this).hasClass("cur")) {
$(this).removeClass("cur").siblings().stop(true, false).slideUp();
} else {
$(this).addClass("cur").siblings().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();
});
});