简体   繁体   English

如何将自定义的下一个/上一个按钮添加到 fsLightbox?

[英]How can I add custom next/previous buttons to fsLightbox?

I'm using a lightbox plugin called fsLightbox ( https://fslightbox.com ).我正在使用一个名为 fsLightbox ( https://fslightbox.com ) 的灯箱插件。 I need to add custom next/previous buttons but I don't understand how.我需要添加自定义的下一个/上一个按钮,但我不明白如何。 I don't see any information in the documentation.我在文档中看不到任何信息。 Can someone point me in the right direction please?有人可以指出我正确的方向吗?

Update: This plugin has built-in next previous buttons that appear on either side of the lightbox.更新:这个插件内置了出现在灯箱两侧的下一个上一个按钮。 I want to add additional next/previous buttons within the lightbox with custom text (the name of the next or previous slide).我想使用自定义文本(下一张或上一张幻灯片的名称)在灯箱中添加其他下一张/上一张按钮。 To accomplish this I'm using a custom source:为此,我使用了自定义源:

<a data-fslightbox="partners" data-class="partner" href="#FirstPartner">
  <img src="FirstPartner.jpg" />
</a>
<a data-fslightbox="partners" data-class="partner" href="#SecondPartner">
  <img src="SecondPartner.jpg" />
</a>

<div class="display-none">
  <div id="FirstPartner">
    <div class="copy-container">
      Some copy
    </div>
    <div class="navigation-container">
      <button onclick="NextSlide()">
        Second Partner >>
      </button>
    </div>
  </div>
  <div id="SecondPartner">
     <div class="copy-container">
      Some copy
    </div>
    <div class="navigation-container">
      <button onclick="PrevSlide()">
        << First Partner
      </button>
    </div>
  </div>
</div>

Since the library does not seem to allow custom buttons there always exists is a css solution.由于该库似乎不允许自定义按钮,因此始终存在 CSS 解决方案。

First we need to hide the svg arrows by setting display: none .首先,我们需要通过设置display: none来隐藏svg箭头。

.fslightbox-slide-btn svg {
  display: none;
}

After that the content is being replaced by My text .之后content被替换为My text

.fslightbox-slide-btn:after {
  content: 'My text';
  color: white;
}

This is what it looks like:这是它的样子:

在此处输入图像描述

Live Demo现场演示

编辑充满活力的黎明sjgr1c

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM