0

我使用了非常酷的 Fancybox 3,唯一让我的客户感到困扰的是,在响应版本的盒子中没有视觉指示,您可以滑动以转到下一张图片。

现在我在 fancybox doc 页面上看到,您可以通过这种方式后加载和添加内容:

afterLoad : function( instance, current ) {
    if ( instance.group.length > 1 && current.$content ) {
      current.$content.append('<div class="swipeto">Swipe to change pictures</div>');
    }

但我不使用通过javascript初始化的fancybox,而是直接通过html属性。我怎样才能确保在fancybox中添加一些东西?

4

2 回答 2

0

例如,您可以编辑默认设置:

$.fancybox.defaults.afterLoad = function( instance, current ) {
    if ( instance.group.length > 1 && current.$content ) {
      current.$content.append('<div class="swipeto">Swipe to change pictures</div>');
    };
};
于 2017-05-19T16:16:03.557 回答
0

我以这种方式解决了它,我对fancybox的CSS文件进行了一些更改,以在响应时显示控件:

@media (max-width: 800px){

.fancybox-button--left, .fancybox-button--right, .fancybox-buttons button:not(.fancybox-button--close) {
    display: inline-block!important;
}
于 2017-05-20T12:02:47.970 回答