如何从多个链接调用相同的fancybox javascript?

Dig*_*aft 2 html javascript fancybox

fancybox模式弹出窗口使用了一些javascript:

$("#PeoplePopup").fancybox({
'autoScale'         : false,
'padding'           : 0,
'width'             : 800,
'height'            : 600,
'transitionIn'      : 'elastic',
'transitionOut'     : 'elastic',
'type'              : 'iframe',
'overlayColor'      : '#000',
'overlayOpacity'    : 0.5
});
Run Code Online (Sandbox Code Playgroud)

单击链接时触发的内容:

<a href = "peoplesearch.aspx"  class="SmallWhite" 
      id="PeoplePopup">Search for Internal Contact details &gt; </a>
Run Code Online (Sandbox Code Playgroud)

如何从多个链接调用相同的弹出代码?

bin*_*680 5

用户class而不是id,所以你可以调用popupcode mutliple时间.

//html
<a href = "peoplesearch.aspx"  class="SmallWhite PeoplePopup">
         Search for Internal Contact details </a>

//other links
<a href = "peoplesearch2.aspx"  class="PeoplePopup">...</a>
<a href = "peoplesearch3.aspx"  class="PeoplePopup">...</a>

//this jquery code will apply to the three links above
$(".PeoplePopup").fancybox({
    //the same code here 
})
Run Code Online (Sandbox Code Playgroud)