Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamic content view using fancybox

I need to view the dynamic content in fancybox

my code looks like

<a id="featureExpertPopup" href="#featureExpertPop">View Profile </a>
<a id="featureExpertPopup" href="#featureExpertPop">View Profile </a>
<a id="featureExpertPopup" href="#featureExpertPop">View Profile </a>

and fancy box content

<div style="display: none;">
    <div id="featureExpertPop" style="overflow:auto;">Dynamic Profile</div>
</div>

fancybox call

$("#featureExpertPopup").fancybox({
        'titlePosition'     : 'inside',
        'transitionIn'      : 'none',
        'transitionOut'     : 'none'

    });

Now the problem is popup opening for first anchor link only, i want to open popup for each link with different content (from database)based on profile id.

like image 401
iLaYa ツ Avatar asked May 26 '26 13:05

iLaYa ツ


1 Answers

You can't use same ID for different elements. Use class instead of ID

<a class="featureExpertPopup" href="#featureExpertPop">View Profile </a>
<a class="featureExpertPopup" href="#featureExpertPop">View Profile </a>
<a class="featureExpertPopup" href="#featureExpertPop">View Profile </a>


$(".featureExpertPopup").fancybox({
        'titlePosition'     : 'inside',
        'transitionIn'      : 'none',
        'transitionOut'     : 'none'

    });
like image 62
Miqdad Ali Avatar answered May 28 '26 03:05

Miqdad Ali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!