$(function () {
headerJs();
footerJs();
$("p:last-child").addClass("no_margin");
function headerJs() {
// pc
if ($(".header-pc").length) {
// 瑙﹀彂鐧藉簳
$("#header").mouseover(function () {
$(this).addClass("on");
}).mouseleave(function () {
$(this).removeClass("on");
})
// 鎼滅储
$('.search-popup .searchform > div .input').on('focusin', function () {
$(this).parents('.searchform').addClass('focus');
}).on('focusout', function () {
if (!$(this).val()) {
$(this).parents('.searchform').removeClass('focus').addClass('focusout').delay(450).queue(function (next) {
$(this).removeClass('focusout');
next();
});
}
});
$('html').on('click', '.header-search-button', function () {
$('body').toggleClass('skrollr');
$(this).toggleClass('active');
$('.search-popup').toggleClass('active');
$('.subscribe-popup').removeClass('active');
})
$(window).scroll(function () {
headInit()
})
headInit()
function headInit() {
var t = $(window).scrollTop();
if (t >= 60) {
$("#header").addClass("onsb")
} else {
$("#header").removeClass("onsb")
}
}
}
// 鎵嬫満
if ($(".header-mobile").length) {
// 瀵艰埅鍒ゆ柇
var thisHref = true;
$(".header-mobile .nav a").each(function () {
var urlstr = location.href;
thisHref = $(this).attr('href');
var nav_name = thisHref.replace(/(.*\/)*([^.]+).*/ig, "$2").replace(/\d+/g, '');
if (thisHref !== '/' && (urlstr + '/').indexOf(thisHref) > -1 && $(this).attr('href') != '') {
$(this).addClass('on');
if ($(this).parents('dd')) {
$(this).parents('dd').slideDown()
$(this).parents('li').addClass('on')
}
return false;
} else {
thisHref = false;
}
});
if (!thisHref) {
$(".header-mobile .nav a").eq(0).addClass('on');
}
const headNav = $(".header-mobile .navBox");
const header = $('.header-mobile .header');
$('.ham').click(function () {
if ($(this).hasClass('on')) {
$(this).removeClass('on');
headNav.fadeOut();
header.removeClass('active')
} else {
$(this).toggleClass('on');
headNav.fadeToggle();
header.addClass('active');
$('.m-login-menu').removeClass('visible');
}
});
$('.header-mobile .nav > li').click(function () {
$(this).toggleClass('on').siblings().removeClass('on');
$(this).find('dd').stop().slideToggle();
$(this).siblings().find('dd').stop().slideUp();
})
}
}
function footerJs() {
}
// 棣栭〉
if ($(".index").length) {
$('.index-swiper').each(function () {
var slide = new Swiper('.index-swiper', {
autoplay: {
delay: 6000,
disableOnInteraction: false,
},
// effect: 'fade',
fadeEffect: {
crossFade: true,
},
speed: 1000,
loop: true,
preventLinksPropagation: false, // 闃绘鐐瑰嚮浜嬩欢鍐掓场
navigation: {
nextEl: '.index-swiper .swiper-button-next',
prevEl: '.index-swiper .swiper-button-prev',
},
pagination: {
el: '.index-swiper .swiper-pagination',
// type: 'fraction',
clickable: true,
renderBullet: function (index, className) {
if (index >= 9) {
return '' + (index + 1) + '';
} else {
return '' + '' + '0' + (index + 1) + '' + '';
}
},
},
});
});
var slide1 = new Swiper('.slide1', {
autoplay: {
delay: 4000,
disableOnInteraction: false,
},
effect: 'fade',
fadeEffect: {
crossFade: true,
},
loop: true,
preventLinksPropagation: false,
navigation: {
nextEl: '.slide1 .swiper-button-next',
prevEl: '.slide1 .swiper-button-prev',
},
pagination: {
el: '.slide1 .swiper-pagination',
clickable: true,
},
});
var detailed3 = $(".index-box3 .tab-wrap .tab-box");
$(".index-box3 .tab-name a").click(function () {
var d = $(this).index();
$(this).addClass("on").siblings().removeClass("on");
detailed3.eq(d).stop().fadeIn().siblings().stop().hide();
return false;
});
$(".index-box3 .tab-name a").eq(0).click();
$(".index-box3 .tab-box:eq(0) .item-box").addClass('wow');
$(".index-box4 .tab-box").each(function (index) {
var slide4 = new Swiper(".news-slide" + (index + 1), {
autoplay: {
delay: 4000,
disableOnInteraction: false,
},
effect: 'fade',
fadeEffect: {
crossFade: true,
},
loop: true,
preventLinksPropagation: false,
observer: true, //鑷姩鍒濆鍖杝wiper
observeParents: true, //鑷姩鍒濆鍖杝wiper
navigation: {
nextEl: '.index-box4 .tab-box .swiper-button-next' + (index + 1),
prevEl: '.index-box4 .tab-box .swiper-button-prev' + (index + 1),
},
pagination: {
el: '.news-slide .swiper-pagination',
clickable: true,
},
});
});
var indexslide5 = new Swiper('.index-slide5', {
slidesPerView: 8,
slidesPerColumn: 1,
// slidesPerColumnFill: 'row',
// spaceBetween: 27,
pagination: {
el: ".index-slide5 .swiper-pagination",
clickable: true,
},
breakpoints: {
780: {
slidesPerView: 2,
// spaceBetween: 14
},
1200: {
slidesPerView: 4,
// spaceBetween: 20
},
1470: {
slidesPerView: 6,
// spaceBetween: 20
}
}
})
}
if ($(".about").length) {
var aboutslide1 = new Swiper('.about-slide', {
// initialSlide: 0,
centeredSlides: true,
speed: 1000,
loop: true,
// slidesPerView: 1,
autoHeight: true,
navigation: {
nextEl: '.about-slide .swiper-button-next',
prevEl: '.about-slide .swiper-button-prev',
},
pagination: {
el: '.about-slide .swiper-pagination',
clickable: true,
},
slideToClickedSlide: true,
observer: true, //鑷姩鍒濆鍖杝wiper
observeParents: true, //鑷姩鍒濆鍖杝wiper
// breakpoints: {
// 780: {
// slidesPerView: 2,
// },
// 1200: {
// slidesPerView: 3,
// }
// },
on: {
slideChangeTransitionStart: function (swiper) {
// console.log(this.activeIndex)
// var d = this.activeIndex;
var d = this.realIndex;
$(".about-box4 .page_nav .list a").stop().removeClass("on").eq(d).addClass("on");
var li_wid = $(".about-box4 .page_nav .list a").eq(0).width();
$(".about-box4 .page_nav").stop().animate({ "scrollLeft": (d) * li_wid });
},
},
});
var li_wid = $(".about-box4 .page_nav .list a").eq(0).width();
$(".about-box4 .page_nav .list a").click(function () {
var a = $(this).index();
$(".about-box4 .about-slide .swiper-pagination-bullet").eq($(this).index()).click();
$(this).addClass("on").siblings().removeClass("on");
$(".about-box4 .page_nav").stop().animate({ "scrollLeft": (a) * li_wid });
});
// 鑽h獕璧勮川
var detailed5 = $(".about-box5 .tab-wrap .tab-box");
$(".about-box5 .tab-name a").click(function () {
var d = $(this).index();
$(this).addClass("on").siblings().removeClass("on");
detailed5.eq(d).stop().fadeIn().siblings().stop().hide();
});
$(".about-box5 .tab-name a").eq(0).click();
}
if ($(".float-ri").length) {
const floatNav = $(".float-ri .navBox");
const float = $('.float-ri');
// $('.name-box').click(function () {
// if ($(this).hasClass('on')) {
// $(this).removeClass('on');
// floatNav.hide();
// float.removeClass('active')
// } else {
// $(this).toggleClass('on');
// floatNav.fadeToggle();
// float.addClass('active');
// }
// });
$('.float-ri .nav > li').click(function () {
$(this).toggleClass('on').siblings().removeClass('on');
$(this).find('dd').stop().slideToggle();
$(this).siblings().find('dd').stop().slideUp();
})
$(".float-ri").mouseover(function () {
floatNav.show();
float.addClass('active');
$(".float-ri .name-box").addClass('on');
}).mouseleave(function () {
floatNav.hide();
float.removeClass('active');
$(".float-ri .name-box").removeClass('on');
});
}
if ($(".enterprise2").length) {
var enterprise2slide1 = new Swiper('.enterprise2-slide', {
speed: 1000,
loop: true,
autoHeight: true,
navigation: {
nextEl: '.enterprise2-box1 .swiper-button-next',
prevEl: '.enterprise2-box1 .swiper-button-prev',
},
pagination: {
el: '.enterprise2-slide .swiper-pagination',
clickable: true,
},
slideToClickedSlide: true,
});
}
if ($(".contact2").length) {
var contact2slide1 = new Swiper('.contact2-slide', {
speed: 1000,
spaceBetween: 24,
slidesPerView: 3,
loop: true,
loopAdditionalSlides: 3,
preventLinksPropagation: false,
autoHeight: true,
navigation: {
nextEl: '.contact2-box2 .swiper-button-next',
prevEl: '.contact2-box2 .swiper-button-prev',
},
pagination: {
el: '.contact2-slide .swiper-pagination',
clickable: true,
},
breakpoints: {
490: {
slidesPerView: 1,
spaceBetween: 0
},
780: {
slidesPerView: 1,
spaceBetween: 0
},
1200: {
spaceBetween: 14
}
}
});
}
if ($(".contact2-d").length) {
$(".tab-ul ul").on("click", 'li .top', function () {
var dd = $(this).next();
var li = $(this).parent();
var other = li.siblings();
var otherDd = other.find(".bom");
li.toggleClass("on");
dd.slideToggle();
other.removeClass("on");
otherDd.slideUp();
})
}
//鑷畾涔変笅鎷
if ($(".mySelect").length) {
$(".mySelect").each(function () {
var s = $(this);
var z = parseInt(s.css("z-index"));
var dt = $(this).children(".show");
var dd = $(this).children(".drapList");
var _show = function () {
dd.slideDown(300);
s.css("z-index", z + 1);
dt.addClass("on");
dt.parent(".mySelect").addClass("on");
}; //灞曞紑鏁堟灉
var _hide = function () {
dd.slideUp(300);
s.css("z-index", z);
dt.removeClass("on");
dt.parent(".mySelect").removeClass("on");
}; //鍏抽棴鏁堟灉
dt.click(function () {
dd.is(":hidden") ? _show() : _hide();
});
dd.on("click", "li", function () {
dt.children("em").html($(this).text());
var _id = $(this).data("id");
var _par = $(this).parents(".mySelect");
_par.find(".show").attr("data-id", _id);
_hide();
})
$("body").click(function (i) {
!$(i.target).parents(".mySelect").first().is(s) ? _hide() : "";
});
});
}
// wow.js
if ($(".wow").length) {
if (!(/msie [6|7|8|9]/i.test(navigator.userAgent))) {
var wow = new WOW({
boxClass: 'wow',
animateClass: 'animated',
offset: 50,
mobile: true,
live: true
});
wow.init();
};
}
})
//灏佽浜嗕竴涓彇娑堥粯璁や簨浠剁殑鍑芥暟锛岀敤鏉ュ吋瀹硅€両E
function cancelHandler(event) {
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false;
}
}
function bindEvent(_id) {
var ele = document.getElementById(_id);
if (!ele) {
return false;
}
//璁剧疆榧犳爣钀戒笅鏃剁殑x銆亂鍧愭爣涓篨鍜孻,鐩掑瓙鐨刲eft鍜宼op鍊煎瓨涓篵oxL鍜宐oxT,榧犳爣钀戒笅鏃剁殑鐐硅窛绂荤洅瀛愬乏杈瑰拰涓婅竟鐨勮窛绂诲瓨涓篸isL鍜宒isT
let X, L, boxL, boxT, disL, disT, drag = false;
ele.onmousedown = function (e) {
drag = true;
var e = e || window.event; //鍏煎ie
X = e.clientX;
Y = e.clientY;
boxL = ele.offsetLeft;
boxT = ele.offsetTop;
disL = X - boxL;
disT = Y - boxT;
cancelHandler(e);
}
document.onmousemove = function (e) {
var e = e || window.event;
if (drag) {
ele.style.left = e.clientX - disL + 'px';
ele.style.top = e.clientY - disT + 'px';
}
}
ele.onmouseup = function () {
drag = false;
}
}
bindEvent('videoimg');
// 闃绘鍐掓场
function stopPropagation(e) {
e = window.event || e;
if (document.all) { // IE
e.cancelBubble = true;
} else {
e.stopPropagation();
}
}
if (!!window.ActiveXObject || "ActiveXObject" in window) {
$("html").addClass("body_ie");
// $("script[src='/build/luxy.js']").remove();
// console.log('is IE');
} else {
// luxy.init();
// console.log('is not IE');
}
submit('cpzx')
function submit(name = '*') {
layui.use(['layer', 'form'], function () {
var form = layui.form;
var layer = layui.layer;
form.on("submit(" + name + ")", function (data) {
var index = layer.load();
let params = data.field;
$.post("/addons/cms/diyform/post", params, function (res) {
layer.close(index);
if (res.code == 1) {
layer.closeAll()
layer.alert(res.msg, { title: false, closeBtn: false }, function () {
location.href = '/'
});
} else {
layer.msg(res.msg)
$("input[name=__token__").val(res.data.__token__)
}
})
})
})
}
(function navLink() {
$(".navLink").on('click', function () {
var id = $(this).attr('data-id');
var link = $(this).attr('href');
if (id) {
localStorage.setItem('__todom__', id);
}
location.href = link;
return false;
})
window.onload = function () {
var getobj = localStorage.getItem('__todom__');
setTimeout(function () {
if (getobj) {
var obj = $('#' + getobj);
var top = obj.offset().top ;
$('html,body').scrollTop(top);
localStorage.removeItem('__todom__');
}
});
}
})()