$(function () {
    //产品目录
    var Accordion = function (el, multiple) {
        this.el = el || {};
        this.multiple = multiple || false;

        // Variables privadas
        var links = this.el.find('.link');
        // Evento
        links.on('click', { el: this.el, multiple: this.multiple }, this.dropdown)
    };

    Accordion.prototype.dropdown = function (e) {
        var $el = e.data.el;
        $this = $(this);
        $next = $this.next();

        $next.slideToggle();
        $this.parent().toggleClass('on');

        if (!e.data.multiple) {
            $el.find('.submenu').not($next).slideUp().parent().removeClass('on');
        }
    };

    var accordion = new Accordion($('#accordion'), false);
    $('.submenu a').click(function () {
        $(this).addClass('on').siblings('a').removeClass('on');
    });
    var w = $(window).width()
    if (w < 767) {
        $(".proBox>.fl .title").click(function () {
            $(".proBox>.fl ul.ul1").slideToggle()
        })
        $("#gNavi li:nth-child(2)>a,#gNavi li:nth-child(3)>a,#gNavi li:nth-child(6)>a,#gNavi li:nth-child(7)>a").attr("href", "javascript:;")

        $("#gNavi li:nth-child(2)>a,#gNavi li:nth-child(3)>a,#gNavi li:nth-child(6)>a,#gNavi li:nth-child(7)>a").click(function () {

            $(this).parent("li").toggleClass("on").siblings("li").removeClass("on")
        })
        $("#gHeader .menu").click(function () {
            $("body").addClass("on")
            $("#gNavi").addClass("on")
        })
        $("#gNavi .close").click(function () {
            $("body").removeClass("on")
            $("#gNavi").removeClass("on")

        })
        //视频中心
        var swiper = new Swiper('.sec6 .swiper-container', {
            slidesPerView: 1,
            spaceBetween: 0,
            loop: true,
            autoplay: {
                delay: 3500,
                disableOnInteraction: false,
            },
            navigation: {
                nextEl: '.sec6 .swiper-button-next',
                prevEl: '.sec6 .swiper-button-prev',
            },
        });

    }
    if (w > 767) {
        $("#gNavi li").hover(function () {
            $(this).find(".drop").show()
            $(this).addClass("on").siblings("li").removeClass("on")
            $("#gHeader").addClass("on")
        }, function () {
            $(this).find(".drop").hide()
            $("#gHeader").removeClass("on")
        })
        $(".fixed .btn").click(function () {
            $(".fixed .kBox").addClass("on")
        })
        $(".fixed span.clos").click(function () {
            $(".fixed .kBox").removeClass("on")
        })
        $(".return").click(function () {
            $("html,body").animate({
                scrollTop: 0
            }, 300);
        });

        //荣誉资质
        var swiper = new Swiper('.sec9  .swiper-container', {
            slidesPerView: 4,
            spaceBetween: 30,
            loop: true,
            pagination: {
                el: '.sec9  .swiper-pagination',
                clickable: true,
            },
            autoplay: {
                delay: 3500,
                disableOnInteraction: false,
            },
        });
        var swiper = new Swiper('.sec8  .swiper-container', {
            slidesPerView: 5,
            spaceBetween: 30,
            loop: true,
            pagination: {
                el: '.sec8  .swiper-pagination',
                clickable: true,
            },
            autoplay: {
                delay: 3500,
                disableOnInteraction: false,
            },
        });

        // $(".sec7  .swiper-container").hide()
        // $(".sec7  .swiper-container").first().show()
        // $(".sec7 .list a").hover(function () {
        //     var ind = $(this).index()
        //     $(".sec7 .tab .swiper-container").eq(ind).show().siblings(".sec7 .tab .swiper-container").hide()
        //     $(this).addClass("on").siblings("a").removeClass("on")

        // }, function () { })


        //视频中心
        var swiper = new Swiper('.sec6 .swiper-container', {
            slidesPerView: 3,
            spaceBetween: 30,
            loop: true,
            autoplay: {
                delay: 3500,
                disableOnInteraction: false,
            },
            navigation: {
                nextEl: '.sec6 .swiper-button-next',
                prevEl: '.sec6 .swiper-button-prev',
            },
        });

    }

    //轮播图
    var swiper = new Swiper('.bannerswiper', {
        slidesPerView: 1,
        spaceBetween: 0,
        loop: true,
        pagination: {
            el: '.bannerswiper .swiper-pagination',
            clickable: true,
        },
        navigation: {
            nextEl: '.bannerswiper .swiper-button-next',
            prevEl: '.bannerswiper .swiper-button-prev',
        },

        autoplay: {
            delay: 4000,
            disableOnInteraction: false,
        },
    });

    //解决方案
    $(".sec2 .dl").hide()
    $(".sec2 .dl").first().show()
    $(".sec2 ul li").first().addClass("on")
    $(".sec2 ul li").hover(function () {
        var inde = $(this).index()
        $(".sec2 .dl").eq(inde).show().siblings(".dl").hide()
        $(this).addClass("on").siblings("li").removeClass("on")
    }, function () { })

    //新闻资讯
    $(".sec5 .tab").hide()
    $(".sec5 .tab").first().show()
    $(".sec5 .list li").hover(function () {
        var inde1 = $(this).index()
        $(".sec5 .tab").eq(inde1).show().siblings(".tab").hide()
        $(this).addClass("on").siblings("li").removeClass("on")
    }, function () { })






})