javascripthtmlcssfancybox-3

How can i call the same fancyapp [fancybox 3.5] javascript from more than one link?


I have a code like this :

<div id="logreg" style="display: none;width:100%;max-width:660px; height:450px;" class="logreg">
   my content 
</div>

and i need use in many links on my site like this :

<a data-fancybox="logreg" data-src="#logreg" href="javascript:;" class="btnReg float-right">
    Register
</a> 
<a data-fancybox="logreg" data-src="#logreg" href="javascript:;">
    <i class="fas fa-user"></i>
</a>

but doesn't work too many links, only one link work :-(

Please help me.


Solution

  • You are creating gallery that contains two items and both items refer to the same content. Therefore simple use different value for data-fancybox element to not create a group and everything will work fine, demo - https://jsfiddle.net/tecnw6x7/