noelboss / featherlight

Featherlight is a very lightweight jQuery lightbox plugin. It's simple yet flexible and easy to use. Featherlight has minimal css and uses no inline styles, everything is name-spaced, it's completely customizable via config object and offers image, ajax and iframe support out of the box. Featherlights small footprint weights about 4kB – in total.
https://www.noevu.ch/featherlight-js-the-ultra-slim-lightbox/
MIT License
2.08k stars 293 forks source link

how to select the clicked element with "data-featherlight" if there are more than one? #425

Open musicjunk opened 2 years ago

musicjunk commented 2 years ago

Is there a way to select the element (button) that opend the lightbox? I've several buttons to open the lightbox always with the same content.

<div class="div1">AAA</div>
<button><a class="" data-featherlight="#modalForm" >open 1</a></button>
</div>
<div class="div1">BBB</div>
<button><a class="" data-featherlight="#modalForm" >open 2</a></button>
</div>

Now I want to add the Text "AAA" or "BBB" to the content of #modalForm. To select the right one, I need to know witch button was clicked. How can $(this) button be selected?

I've testet with current but I guess this holds the opend lightbox not $(this) clicked button.