$(function(){
    
    // 轮播图
    // new Swiper('.post-43 .full-banner', {
    //     slidesPerView: 1,
    //     loop: true,
    //     autoplay: 3000,
    //     watchActiveIndex: true,
    //     autoplayDisableOnInteraction: false,
    //     calculateHeight: false,
    //     observer: true,
    //     observeParents: true,
    //     onSlideChangeEnd: function (swiper) {
    //         $('.main1 .total .curIndex').text(swiper.activeLoopIndex + 1);
    //     }
    // })
    // new Swiper('.post-44 .full-banner', {
    //     slidesPerView: 1,
    //     loop: true,
    //     autoplay: 3000,
    //     watchActiveIndex: true,
    //     autoplayDisableOnInteraction: false,
    //     calculateHeight: false,
    //     observer: true,
    //     observeParents: true,
    //     onSlideChangeEnd: function (swiper) {
    //         $('.main1 .total .curIndex').text(swiper.activeLoopIndex + 1);
    //     }
    // })


    //新闻切换
    // $('.tt2 .title').click(function(){
    //     $(this).addClass('selected').siblings().removeClass('selected');
    //     $(".main1 .con .mod").eq($(this).index()).addClass("selected").siblings().removeClass("selected");
    // })


    function isMobileDevice () {
        var deviceWid = $(window).width();
        if (deviceWid < 927) {
            return true
        } else {
            return false
        }
    }

    // 3d轮播图
    curSwiper = new Swiper('.main4 .full-banner', {
        slidesPerView: isMobileDevice() ? 1.5 : 2.1,
        centeredSlides: true,
        loop: true,
        autoplay: 4000,
        autoplayDisableOnInteraction: false,
        watchSlidesProgress: true,
        calculateHeight: true,//自适应高度
        tdFlow: {
            rotate: 0,
            stretch: 56,//每个slide之间拉伸值(负值远离)
            depth: 420,  //值越大图片越往后退(可负值)
            modifier: 1,
            shadows: false
        }
    })

    $('body').off('click', '.main4 .arrow-left').on('click', '.main4 .arrow-left', function () {
        curSwiper.swipePrev()
    })
    $('body').off('click', '.main4 .arrow-right').on('click', '.main4 .arrow-right', function (e) {
        e.preventDefault()
        curSwiper.swipeNext()
    })



    $('body').on('mouseenter', '.header .nav-container > .item', function (e) {
        $('.nav-down-list').mCustomScrollbar("destroy");
        var curNavList = $(this).find('.item-list').html();
        var top = $(this).parents('.header-nav-list').height();
        var left = $(this).offset().left;
        var list = $(this).parents('.header-nav-list').find('.nav-down-list');
        list.html(curNavList);
        $('.nav-down-list').mCustomScrollbar({
            theme: "minimal-dark"
        });
        list.show();
        list.css({
            'left': left,
            'top': top - 1
        })
    });
    $('body').off('mouseleave', '.header-nav-list').on('mouseleave', '.header-nav-list', function (e) {
        $(this).find('.nav-down-list').hide();
    });

})