swiper 3D切换_编程笔记

swiper 3D切换

2023-09-05 14:32:49  浏览:725  作者:保利尼奥
<div class="nei4"> <div class="changh clearfix"> <div class="cpp wow slideInUp"> <div class="cpp_a">荣誉资...
<div class="nei4">
    <div class="changh clearfix">
        <div class="cpp wow slideInUp">
            <div class="cpp_a">荣誉资质</div>
            <div class="cpp_b">HONORARY QUALIFICATION</div>
        </div>
        <div class="tngyut wow slideInUp">
            <div id="certify">
                <div class="swiper-container">
                    <div class="swiper-wrapper">
                        {% for value in app('section').id('23664') %}
                        <div class="swiper-slide"><img src="{{ value.img[0] }}" /></div>
                        {% endfor %}
                    </div>
                </div>

                <div class="swaev"></div>
                <div class="swigt"></div>
            </div>
        </div>
    </div>
</div>


<script>
    certifySwiper = new Swiper('#certify .swiper-container', {
        watchSlidesProgress: true,
        slidesPerView: 'auto',
        centeredSlides: true,
        loop: true,
        loopedSlides: 5,
        autoplay: false,
        navigation: {
            nextEl: '.swaev',
            prevEl: '.swigt',
        },

        on: {
            progress: function(progress) {
                for (i = 0; i < this.slides.length; i++) {
                    var slide = this.slides.eq(i);
                    var slideProgress = this.slides[i].progress;
                    modify = 1;
                    if (Math.abs(slideProgress) > 1) {
                        modify = (Math.abs(slideProgress) - 1) * 0.3 + 1;
                    }
                    translate = slideProgress * modify * 220 + 'px';
                    scale = 1 - Math.abs(slideProgress) / 5;
                    zIndex = 999 - Math.abs(Math.round(10 * slideProgress));
                    slide.transform('translateX(' + translate + ') scale(' + scale + ')');
                    slide.css('zIndex', zIndex);
                    slide.css('opacity', 1);
                    if (Math.abs(slideProgress) > 3) {
                        slide.css('opacity', 0);
                    }
                }
            },
            setTransition: function(transition) {
                for (var i = 0; i < this.slides.length; i++) {
                    var slide = this.slides.eq(i)
                    slide.transition(transition);
                }

            }
        }

    })
</script>
/*---------------*/
.nei4{
    overflow: hidden;
    padding: 3% 0;
}


#certify {
	position: relative;
	margin-top:3%;
}

#certify .swiper-container {
	padding-bottom: 60px;
}

#certify .swiper-slide {
	width: 550px;
	height: 416px;
	background: #rgba(255,255,255,0);
	box-shadow: 0 8px 30px #ddd;
}
#certify .swiper-slide img{
	display:block;
    width: 100%;
    height: auto;
}
#certify .swiper-slide p {
	line-height: 98px;
	padding-top: 0;
	text-align: center;
	color: #636363;
	font-size: 1.1em;
	margin: 0;
}

#certify .swiper-pagination {
	width: 100%;
	bottom: 20px;
}

#certify .swiper-pagination-bullets .swiper-pagination-bullet {
	margin: 0 5px;
	border: 3px solid #fff;
	background-color: #d5d5d5;
	width: 10px;
	height: 10px;
	opacity: 1;
}

#certify .swiper-pagination-bullets .swiper-pagination-bullet-active {
	border: 3px solid #00aadc;
	background-color: #fff;
}

#certify .swiper-button-prev {
	left: -30px;
	width: 45px;
	height: 45px;
	background: url(../images/wm_button_icon.png) no-repeat;
	background-position: 0 0;
	background-size: 100%;
}

#certify .swiper-button-prev:hover {
	background-position: 0 -46px;
	background-size: 100%
}

#certify .swiper-button-next {
	right: -30px;
	width: 45px;
	height: 45px;
	background: url(../images/wm_button_icon.png) no-repeat;
	background-position: 0 -93px;
	background-size: 100%;
}

#certify .swiper-button-next:hover {
	background-position: 0 -139px;
	background-size: 100%
}
.swaev{
    position: absolute;
    top:40%;
    right: -6%;
    background: url(//cdn.myxypt.com/c121a9e6/22/07/31253e5af3a092233e6d3ca51f5e9d0203d3a84d.png) no-repeat;
    width: 37px;
    height: 37px;
    outline: none;
    border: none;
    z-index: 9999;
}
.swigt{
    position: absolute;
    top:40%;
    left: -6%;
    background: url(//cdn.myxypt.com/c121a9e6/22/07/5a02d4798e493cd7b63bdddf252774c795d3cbb7.png) no-repeat;
    width: 37px;
    height: 37px;
    outline: none;
    border: none;
    z-index: 9999;
}


评论区

共 0 条评论
  • 这篇文章还没有收到评论,赶紧来抢沙发吧~

【随机内容】

返回顶部