// wap menu
let nav = (status) => {
if(status) {
document.querySelector('.wapnav').classList.add('show')
} else {
document.querySelector('.wapnav').classList.remove('show')
}
}
let navToggle = (e) => {
let hasShow = e.className.indexOf('show')
let height
if(hasShow == -1) {
document.querySelectorAll('.wapnav li i').forEach((item, index, array) => {
item.removeAttribute('class')
})
e.classList.add('show')
document.querySelectorAll('.drop-nav').forEach((item, index, array) => {
item.removeAttribute('style')
})
height = e.nextElementSibling.nextElementSibling.children.length * document.querySelector('.drop-nav a').clientHeight
} else {
e.classList.remove('show')
e.nextElementSibling.nextElementSibling.removeAttribute('style')
}
e.nextElementSibling.nextElementSibling.style.height = height + 'px'
}
// search
function searchBy() {
var value = $("#keyword").val();
if(value == "") {
alert("璇疯緭鍏ュ叧閿瓧");
return false;
}
return true;
}
// JQ loading
$(function(){
$('ul.pcnav li.nav-item').hover(function(){
$(this).children('div.subMenu').stop().slideToggle(600);
})
// $('.pchead').mousemove(function(){
// $(this).addClass('pchactive');
// })
// $('.pchead').mouseleave(function(){
// $(this).removeClass('pchactive');
// })
var $window = $(window);
var $header = $('.pchead');
$window.on('scroll', function() {
// didScroll = true;
if ($window.scrollTop() > $header.height()) {
$header.addClass('pchactive');
} else {
$header.removeClass('pchactive');
}
});
// banner
var mySwiper = new Swiper('.mySwiper',{
loop: true,
autoplay:true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
})
// 鏂板搧鎺ㄨ崘婊氬姩
if(screen.width <= 780){
var newestSwiper = new Swiper('.newest-swiper',{
slidesPerView: 1,
spaceBetween: 0,
autoplay: {//寮€鍚嚜鍔ㄦ挱鏀
delay:5000,
disableOnInteraction: false,//瑙︽懜鍚庝笉浼氬仠姝㈣嚜鍔ㄦ粴鍔
pauseOnMouseEnter: true,//榧犳爣缃簬swiper鏃舵殏鍋滆嚜鍔ㄥ垏鎹紝榧犳爣绂诲紑鏃舵仮澶嶈嚜鍔ㄥ垏鎹€
},
pagination: {
el: '.newest-swiper .swiper-pagination',
clickable :true,
renderBullet: function (index, className) {
return '' + (index + 1) + '';
},
},
navigation: {
nextEl: '.newest-swiper .swiper-button-next',
prevEl: '.newest-swiper .swiper-button-prev',
},
})
}else{
$('#banner').height($(window).height());
var newestSwiper = new Swiper('.newest-swiper',{
slidesPerView: 4,
spaceBetween: 25,
slidesPerGroup: 4,
autoplay: {//寮€鍚嚜鍔ㄦ挱鏀
delay:5000,
disableOnInteraction: false,//瑙︽懜鍚庝笉浼氬仠姝㈣嚜鍔ㄦ粴鍔
pauseOnMouseEnter: true,//榧犳爣缃簬swiper鏃舵殏鍋滆嚜鍔ㄥ垏鎹紝榧犳爣绂诲紑鏃舵仮澶嶈嚜鍔ㄥ垏鎹€
},
pagination: {
el: '.newest-swiper .swiper-pagination',
clickable :true,
renderBullet: function (index, className) {
return '' + (index + 1) + '';
},
},
navigation: {
nextEl: '.newest-swiper .swiper-button-next',
prevEl: '.newest-swiper .swiper-button-prev',
},
})
}
// zetu
var mySwiper = new Swiper('.projectbox',{
loop: true,
autoplay:true,
autoHeight: true,
pagination: {
el: '.swiper-pagination',
clickable: true,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
})
// loading img
// $("img.lazy").lazyload({
// placeholder : "https://cdn.bootcss.com/OwlCarousel2/2.2.1/assets/ajax-loader.gif",
// effect: "fadeIn",
// threshold :180
// })
// BackTop
//$('.backtop').click(function(){
// $('body,html').animate({scrollTop:0}, 300);
// return false;
//})
})