jq(function () {
    if (!jq('.h2o_opcnr_top .h2o_opcnr_details .h2o_opcnr_info a')[0]) {
        jq('.h2o_opcnr_top .h2o_opcnr_details .h2o_opcnr_info').hide();
        jq('.h2o_opcnr_top').css({ 'padding-right': '20px' })
    }
    let toutiaoSwiper = new Swiper('.h2o_opcnr_swiper', {
        autoplay: {
            disableOnInteraction: false,
            delay: 5000,
        },//可选选项，自动滑动
        autoHeight: true,
        loop: true,//无限循环
        spaceBetween: 10,
        slidesPerView: 'auto',
        navigation: {
            nextEl: ".h2o_opcnr_arrow.h2o_opcnr_right",
            prevEl: ".h2o_opcnr_arrow.h2o_opcnr_left",
        },
        pagination: {
            el: ".pagination",
            bulletClass: 'h2o_opcnr_hpdot',
            bulletActiveClass: 'h2o_opcnr_hpactive',
            clickable: true,
        },
        on: {
            slideChange: function () {
                let index = this.realIndex;
                jq('.h2o_opcnr_top .h2o_opcnr_details .h2o_opcnr_info .h2o_opcnr_item').eq(index).addClass('active').siblings().removeClass('active');
            },
        }
    });
    jq('.h2o_opcnr_top .h2o_opcnr_details .h2o_opcnr_info').delegate('.h2o_opcnr_item', 'mouseenter', function () {
        let element = jq(this)
        let index = element.index();
        toutiaoSwiper.slideTo(index);//切换到第一个slide，速度为1秒
        element.addClass('active').siblings().removeClass('active');
    })
    new Swiper('.h2o_opcnr_rolltip .h2o_opcnr_rtbox', { //.swiper-containe去掉控制台会报错
        autoplay: {
            disableOnInteraction: false,
        },//可选选项，自动滑动
        loop: true,//无限循环
        direction: "vertical",
    });
    jq('.h2o_opcnr_top .h2o_opcnr_details .h2o_opcnr_swiper').hover(function () {
        let element = jq(this);
        element.find('.h2o_opcnr_arrow').addClass('flex');
    }, function () {
        let elementRight = jq(this).find('.h2o_opcnr_arrow.h2o_opcnr_right');
        elementRight.addClass('rightFadeOut'); //动画
        let elementLeft = jq(this).find('.h2o_opcnr_arrow.h2o_opcnr_left');
        elementLeft.addClass('leftFadeOut'); //动画
        setTimeout(res => { elementRight.removeClass('rightFadeOut flex'); elementLeft.removeClass('leftFadeOut flex'); }, 280);
    });



})