【问题标题】:use title attribute for caption with fancybox4将 title 属性用于带有 fancybox4 的标题
【发布时间】:2021-09-23 13:37:10
【问题描述】:

使用fancybox4是否可以使用title属性作为标题?

<a href="aaaa.jpg" title="Image 1" rel="lightbox[aaa]"><img src="aaa.jpg" alt="alt image 1"></a>

Fancybox.bind("a[rel^=lightbox]", {
  groupAll : true,
  caption: ........
});

此处示例:https://jsfiddle.net/eh2q3zr0/

【问题讨论】:

    标签: javascript fancybox caption


    【解决方案1】:

    我通过更改标题选项解决了这个问题:

    Fancybox.bind("a[rel^=lightbox]", {
      groupAll : true,
      caption: function(fancybox, carousel, slide) {
        return slide.$trigger.title || '';
      }
    });
    

    【讨论】:

    • 好解决方案)))
    猜你喜欢
    • 1970-01-01
    • 2020-02-15
    • 1970-01-01
    • 2014-03-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-01
    相关资源
    最近更新 更多