TA的每日心情 | 郁闷 2020-6-19 14:19 |
---|
签到天数: 1 天 [LV.1]初来乍到
新手上路
- 积分
- 10
|
使用的是官网PC应用的DEMO,单独可以运行引入项目之后无法左右滑动,有没有大佬知道问题在哪,代码贴在下面
<div class="sxiangmu">
<div id="certify">
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide"><p>非常难得又值钱的认证证书</p></div>
<div class="swiper-slide"><p>深圳市优秀互联网企业认定证书</p></div>
<div class="swiper-slide"><p>质量管理体系认证荣誉证书</p></div>
<div class="swiper-slide"><p>计算机软件著作权登记证书</p></div>
<div class="swiper-slide"><p>增值电信业务经营许可证</p></div>
</div>
</div>
</div>
</div>
<script src="js/swiper.min.js" type="text/javascript" charset="utf-8"></script>
<script>
var certifySwiper = new Swiper('#certify .swiper-container', {
watchSlidesProgress: true,
slidesPerView: 'auto',
centeredSlides: true,
loop: true,
loopedSlides: 3,
autoplay: true,
on: {
progress: function(progress) {
for (i = 0; i < this.slides.length; i++) {
var slide = this.slides.eq(i);
var slideProgress = this.slides.progress;
modify = 1;
if (Math.abs(slideProgress) > 1) {
modify = (Math.abs(slideProgress) - 1) * 0.3 + 1;
}
translate = slideProgress * modify * 260 + '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>
|
|