home.js 2.94 KB
$(function () {
    window.onload = function() {
        var mySwiper = new Swiper ('.swiper-container', {
            direction: 'horizontal',
            loop: true,
            speed: 500,
            autoplay: {
                disableOnInteraction: false, //手动滑动之后不打断播放
                delay: 2000
            },

            // 如果需要分页器
            pagination: {
                el: '.swiper-pagination',
            },

            // 如果需要滚动条
            scrollbar: {
                el: '.swiper-scrollbar',
            },
        })
    }

    var isMobile = document.body.clientWidth <= 768

    //index banner
    $('.banner_index').flexslider({
        animation: 'slide',
        controlNav: !isMobile,
        directionNav: !isMobile,
        keyboard: true,
        slideshow: true,  // Boolean: 是否自动播放
        slideshowSpeed: 5000, // Integer: ms 滚动间隔时间
        animationSpeed: 1000, // Integer: ms 动画滚动速度
        pauseOnAction: false,
        animationLoop: true,
        //pauseOnHover: true,
        //触屏滑动后继续自动轮播
        before: function (slider) {
            slider.pause()
            slider.play()
        }
    })

    // css3
    var isIE = function (ver) {
        ver = ver || ''
        var b = document.createElement('b')
        b.innerHTML = '<!--[if IE ' + ver + ']>1<![endif]-->'
        return b.innerHTML === '1'
    }

    if (isIE(8) || isIE(7)) {

    } else {
        //        动画
        wow = new WOW({
            animateClass: 'animated'
        })
        wow.init()
    }

    var c_width = document.body.clientWidth
    var _index = 0
    if (c_width <= 1920) {
        $('.in1_list ul li').mouseover(function () {
            _index = $(this).index()
            $(this).stop().stop().animate({width: 530}, 500).siblings('li').stop().animate({width: 284}, 500)
            $(this).addClass('on').siblings().removeClass('on')
        })
    }
    if (c_width <= 1600) {
        $('.in1_list ul li').mouseover(function () {
            _index = $(this).index()
            $(this).stop().stop().animate({width: 510}, 500).siblings('li').stop().animate({width: 230}, 500)
            $(this).addClass('on').siblings().removeClass('on')
        })
    }

    jQuery('.slideTxtBox').slide({
        effect: 'left',
        // trigger:"click",
        pnLoop: true,
    })

    jQuery('.in3_slide').slide({
        mainCell: '.in3_list ul',
        effect: 'leftLoop',
        autoPlay: true,
        autoPage: true,
        scroll: '1',
        vis: 3,
        prevCell: '.in3btn_prev',
        nextCell: '.in3btn_next'
    })

    // 数字增加

    $('.single-num').countUp()

    // qjp xinjia
    $("#nav a").off("click").on("click",function(){
        var index = $(this).index();
        $(this).addClass("on").siblings().removeClass("on");

        $("#contentBox .box").eq(index).addClass("active").siblings().removeClass("active");
    });
})