$(function () {
    AOS.init({
        easing: 'ease',
        duration: 1000,
        disable: window.innerWidth < 1024//屏幕尺寸小于1024禁用
    });
    // 搜索
    $(".search_btn").click(function () {
        $(".search_box").addClass("active");
    })
    $(".s_close").click(function () {
        $(".search_box").removeClass("active");
    })
    $('.hero-banner,.zybanner').addClass('active');
     // 导航
     $('.headTop span').click(function(){
        $(this).toggleClass('on');
        $('.headTop_nav').slideToggle();
      })
   /* $('.nav li').mouseover(function(){
        $(this).find('.nav_open').slideDown();
        $('.maskBg').fadeIn(300)
    }).mouseleave(function(){
         $(this).find('.nav_open').slideUp();
        $('.maskBg').fadeOut(300)
     })*/
//     $('.nav li:nth-child(2)').click(function(){
//         $('.nav_open2').slideUp()
//         if($('.nav_open1').is(':hidden')){
//         $('.nav_open1').slideDown()
//         $('.maskBg').fadeIn(300)
//         }
//     })
//     $('.nav li').click(function(){
//         var i = $(this).index();
//         $(this).addClass('on').siblings().removeClass('on')
//         if(i!=0&&i!=1){
//             $('.nav_open1').slideUp()
//             if($('.nav_open2').is(':hidden')){
//             $('.nav_open2').slideDown()
//             $('.maskBg').fadeIn(300)
//             }
//         }
//     })
//   // 关闭
//   $('.header1 .nav_open .close').click(function(){
//     $(this).parents('.nav_open').slideUp();
//     $('.maskBg').fadeOut(300)
//   })
//   $('.maskBg').click(function(){
//     $('.header1 .nav_open .close').click()
//   })
    var barSwiper = new Swiper(".hero-banner", {
        autoplay: true,
        effect: 'fade',
        pagination: {
            el: ".swiper-pagination",
            clickable: true,
        },
    });
    var swiper = new Swiper(".mySwiper1", {
        direction: "vertical",
        spaceBetween: 0,
        slidesPerView: 6,
        freeMode: true,
        watchSlidesProgress: true,
    });
    var swiper2 = new Swiper(".mySwiper2", {
        spaceBetween: 0,
        navigation: {
            nextEl: ".next",
            prevEl: ".prev",
        },
        thumbs: {
            swiper: swiper,
        },
    });
    var swiper3111 = new Swiper(".box3_r__swiper", {
        autoplay: {
            delay: 10000,//10秒切换一次
        },
        pagination: {
            el: ".box3_r__paginations",
            clickable: true,
        },
    });
    var swiper3 = new Swiper(".mySwipers3", {
        autoplay: true,
        pagination: {
            el: ".swiper-pagination",
            type: "fraction",
        },
    });
    var swiper4 = new Swiper(".mySwiperNew1", {
        slidesPerView: 1,
        grid: {
            rows: 4,
        },
        pagination: {
            el: ".paginationNew1",
            clickable: true,
        },
    });
    var swiper5 = new Swiper(".mySwiperNew2", {
        slidesPerView: 1,
        grid: {
            rows: 4,
        },
        pagination: {
            el: ".paginationNew2",
            clickable: true,
        },
    });
    // 首页新闻切换
    $('.news .tabs .item').mouseover(function () {
        $(this).addClass('on').siblings().removeClass('on');
        var i = $(this).index();
        $('.newSwiperBox .mySwiperNew').css('opacity', 0)
        $('.newSwiperBox .mySwiperNew').eq(i).css('opacity', 1)
    })
    setTimeout(function(){
        var bnrSwiper = new Swiper(".bnrSwiper", {
            autoplay: true,
            pagination: {
                el: ".swiper-pagination",
                type: "fraction",
            }
        });
    },200)


    // 咨询弹框
    $('.seekAdvice .close').click(function () {
        $('.seekAdvice').hide();
    })
});
//aos 同一行 元素延迟加载
function aosDelay(box, row, delayTime) {
    $(box).children().each(function (index) {
        for (var i = 0; i < row; i++) {
            if (index % row == i) {
                $(this).attr("data-aos-delay", i * delayTime);
            };
        };
    });
};