23,404
社区成员
发帖
与我相关
我的任务
分享
<script type="text/javascript">
var certifySwiper = new Swiper('#certify .gallery-home-banner', {
watchSlidesProgress : true,
slidesPerView : 'auto',
centeredSlides : true,
loop : true,
loopedSlides : 5,
speed : 500,
autoplay : 3000,
prevButton : '.swiper-button-prev',
nextButton : '.swiper-button-next',
pagination : '.swiper-pagination',
paginationClickable : true,
onProgress : function(swiper, progress) {
for (i = 0; i < swiper.slides.length; i++) {
var slide = swiper.slides.eq(i);
var slideProgress = swiper.slides[i].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);
}
}
},
onSetTransition : function(swiper, transition) {
for ( var i = 0; i < swiper.slides.length; i++) {
var slide = swiper.slides.eq(i)
slide.transition(transition);
}
},
//处理分页器bug
onSlideChangeStart : function(swiper) {
if (swiper.activeIndex == 2) {
swiper.bullets.eq(3).addClass(
'swiper-pagination-bullet-active');
console.log(swiper.bullets.length);
}
}
})
//强力推荐
var swiper = new Swiper('.gallery-home-recommend', {
pagination : '.swiper-pagination-recommend',
paginationClickable : true,
autoplay : 10000,
loop : true,
nextButton : '.swiper-button-next-recommend',
prevButton : '.swiper-button-prev-recommend',
slidesPerView : 1,
spaceBetween : 0
});
//
//热门标签
var swiper = new Swiper('.gallery-home-hot-list', {
slidesPerView : 1,
spaceBetween : 0,
autoplay : 10000,
loop : true,
nextButton : '.swiper-button-next-hot',
prevButton : '.swiper-button-prev-hot',
pagination : '.swiper-pagination-hot',
paginationClickable : true
});
//日历
$(".js-time-day").flatpickr({
"locale" : "zh",
inline : true
});
</script>