• Hi i’m using the afterContent filter (described in the Featherlight documentation) to put a button in the corner of the overlay.
    this works

    $('.entry').featherlightGallery({
    filter: ".wp-block-image a", // reaching the image link
        afterContent: //code to insert a link button in the corner...
    function() {   
            this.$legend = this.$legend || $('<a class="moreinfo" target="_blank" href="" />').insertAfter(this.$content);
            this.$legend.attr('href', this.$currentTarget.find('img').attr('data-link'));
            this.$legend.text('i');
          }
    )};

    this doesn’t

    $('.entry').featherlightGallery({
    filter: "li.blocks-gallery-item a", // trying to reach the image link
        afterContent: //code to insert a link button in the corner...
    function() {   
            this.$legend = this.$legend || $('<a class="moreinfo" target="_blank" href="" />').insertAfter(this.$content);
            this.$legend.attr('href', this.$currentTarget.find('img').attr('data-link'));
            this.$legend.text('i');
          }
    )};
    • This topic was modified 3 years, 10 months ago by hafman.
    • This topic was modified 3 years, 10 months ago by hafman.
Viewing 1 replies (of 1 total)
  • Thread Starter hafman

    (@hafman)

    To explain the above, the problem is that the button works for single images on the page. In a wp-block-gallery it doesn’t appear.

    If you start by clicking a single image though, featherlight will run through all the images on the page and show the button.

    For some reason, the wp-block-gallery interferes with the button code.

    Any ideas?

Viewing 1 replies (of 1 total)
  • The topic ‘afterContent filter not finding block gallery items’ is closed to new replies.