简体   繁体   中英

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.

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM