natural-gallery-js icon indicating copy to clipboard operation
natural-gallery-js copied to clipboard

Ability to customize gallery items

Open hyperstown opened this issue 11 months ago • 2 comments

Hi. I noticed that currently is quite hard to do any customization on gallery items. I need to add a button to each image and I thought about two solutions:

Modify 'item-added-to-dom' event so it returns also item.element instead only item.model, or make a custom method in Item class similar to what photoSwipe did:

photoSwipe.pswp.ui.registerElement({
  name: "test-button",
  ariaLabel: "Add to favs",
  order: 9,
  isButton: true,
  html: '<i class="bi bi-heart" style="text-shadow: 2px 2px 5px black;"></i>',
  onClick: (event, el) => {
    addToFavs(event, el)
  },
});

hyperstown avatar Aug 04 '23 13:08 hyperstown