www.gusucode.com > 【T752】食品白酒红酒酒类企业织梦模板源码程序 > 【T752】食品白酒红酒酒类企业织梦模板/templets/twj/Public/js/index.js

    (function(){
    var mySwiper = new Swiper('.swiper-container',{
        pagination: '.pagination',
        loop:true,
        grabCursor: true,
        speed: 500,
        autoplay: 5000,
        onlyExternal : true,
        paginationClickable: true,


        onSlideChangeEnd: function (swiper) {

            console.log(swiper.activeIndex);
        }


    })

    $('.pagination1 .swiper-pagination-switch').click(function(){
        var timer = null;

        mySwiper.swipeTo($(this).index())
        //clearInterval(timer);
        gameover();

        timer = setInterval(function(){
            mySwiper.swipeNext();
        },8000);

    })

    var timer = null;
    // 移上图片
    $(".swiper-slide  img").mouseover(function(){
        gameover();
    });
    //离开图片
    $(".swiper-slide  img").mouseout(function(){
        timer=setInterval(function(){
            mySwiper.swipeNext();
        },8000);
    })

    showCode('.banner-one','.zhongqiu');
    showCode('.banner-two','.longwen');

    hidCode('.zhongqiu');
    hidCode('.longwen');


    window.onload = resizeBannerHeight;

    $(window).resize(resizeBannerHeight);

    //重制banner高度
    function resizeBannerHeight(){
        var bannerImgHeight = $(".banner-img").height();
        $(".swiper-container")
          .add(".swiper-wrapper")
          .add(".swiper-slide")
          .css("height",bannerImgHeight);
    }

    function gameover(){
        var end = setTimeout(function(){},1);
        var start = (end -200)>0?end-200:0;
        for(var i=start;i<=end;i++){
            clearTimeout(i);
        }
    }


    function showCode(cls,code){
        $(cls).on('click',function(){
            $(code).show();
        })
    }

    function hidCode(cls){
        $(cls).on('click',function(){
            $(cls).hide();
        });

    }


    var screenH = document.documentElement.clientHeight;
    $('.normal-code .bg').css({height:screenH});


})();