【发布时间】:2015-09-02 19:09:37
【问题描述】:
我有一个带有分页功能的 Swiper 设置,但是我想给每个分页按钮一个自定义类。这很简单,但我想知道 Swiper 是否提供了这种功能?理想情况下,每张 Swiper 幻灯片都有一个类名,并且在生成分页时,它可以提取每张幻灯片的类名。如果您查看下面的 JADE,理想情况下,我可以从每张幻灯片中提取“服务”、“十一奉献”、“参与”、“练习”和“分享”类,并将其应用于相应的分页元素。 HTML 是灵活的,所以如果这是可能的,并且类需要在其他地方,我可以做到这一点。 这是我的代码的样子:
玉
div(class="swiper-wrapper")
div(class="swiper-slide serve")
a(href="/serve" class="coverflow-link")
div(class="col-sm-12")
h1(class="text-center cf-heading") Serve
div(class="swiper-slide tithe")
a(href="/give" class="coverflow-link")
div(class="col-sm-12")
h1(class="text-center cf-heading") Tithe
div(class="swiper-slide engage")
a(href="/smalllgroups" class="coverflow-link")
div(class="col-sm-12")
h1(class="text-center cf-heading") Engage
div(class="swiper-slide practice")
a(href="/worshipfully" class="coverflow-link")
div(class="col-sm-12")
h1(class="text-center cf-heading") Practice
div(class="swiper-slide share")
a(href="/invite" class="coverflow-link")
div(class="col-sm-12")
h1(class="text-center cf-heading") Share
div(class="swiper-button-next swiper-button-black")
div(class="swiper-button-prev swiper-button-black")
div(class="col-sm-12")
div(class="swiper-pagination center-block")
Javascript
var galleryTop = new Swiper('.gallery-top', {
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
spaceBetween: 10,
speed: 600,
effect: 'coverflow',
pagination: '.swiper-pagination',
paginationClickable: true,
paginationBulletRender: function (index, className) {
return '<span class="' + className + '">' + (index + 1) + '</span>';
}
});
【问题讨论】:
标签: javascript swiper