【问题标题】:How can I make custom pagination in splidejs如何在 splidejs 中进行自定义分页
【发布时间】:2021-07-17 18:31:55
【问题描述】:

我正在尝试使用 splidejs 滑块在右侧实现此数字分页,但无法做到。

到目前为止,我所拥有的是这个。

这是我的自定义分页代码

{
#testimonial-splide .splide__pagination
   {
    display: flex;
    flex-direction: column;
    bottom: 50%;
    left: auto;
    right: -5.5em;
    transform: translateY(50%);
   }
#testimonial-splide .splide__pagination__page {
    display: inline-block;
    width: 20px;
    height: 20px;
    background: transparent;
    border-radius: 50%;
    margin: 10px;
    padding: 0;
    transition: transform .2s linear;
     border: 2px solid var(--darkblue);
    opacity: 1;
    // color: var(--red);
    font-size: 24px;
    font-weight: bold;
    color: #999;
    font-family: "Abril Fatface", serif;  
}
#testimonial-splide .splide__pagination__page.is-active {
    background: var(--red);
    border: 2px solid var(--red);
}
}

【问题讨论】:

标签: css slider splidejs


【解决方案1】:

如果你不想使用默认按钮分页,你必须使用APIs来实现它。

最简单的方法是在您自己的自定义分页页面中添加EventListener,并使用go(control, wait = true) 方法来浏览幻灯片。

如果您想将另一个滑块作为自定义分页,您可以使用sync(splide) 方法。

编辑:

使用最近发布的Splide v3,现在可以更轻松地创建自己的custom pagination。虽然它不像使用 API 那样可定制,但它更适合简单的样式更改。

【讨论】:

    猜你喜欢
    • 2016-04-15
    • 1970-01-01
    • 2012-08-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-29
    • 2015-08-20
    • 2021-07-31
    相关资源
    最近更新 更多