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 > </a>
如何从多个链接调用相同的弹出代码?
最佳答案
用户 class
而不是 id
,所以你可以多次调用 popupcode。
//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/