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

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

单击链接时将触发:
<a href = "peoplesearch.aspx"  class="SmallWhite"
      id="PeoplePopup">Search for Internal Contact details &gt; </a>

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

最佳答案

用户class而不是id,因此您可以多次调用弹出代码。

//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
})

关于javascript - 如何从多个链接中调用相同的fancybox JavaScript?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11735449/

10-09 23:30