我已经在SO上搜索过类似主题,但没有任何解决方案适用于我。我通过Ajax链接填充我的页面。像这样:动态链接上的Fancybox
$.post('php/common/auction_view/auction_invoices.php', function(data){
$('#auction-invoices').html(data);
//Initiate Fancybox on links
$("a.example4").fancybox({
'opacity' : false,
'overlayShow' : false,
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'type' : 'iframe'
});
});
虽然,这是行不通的。有没有人有办法解决吗? Thanx!
编辑:奥基,找到了解决办法:
$.post('php/common/auction_view/auction_invoices.php', function(data){
$('#auction-invoices').html(data);
$.getScript("fancybox/jquery.fancybox-1.3.4.js", function(){
$.fancybox.init();
$("a.example4").fancybox({
'transitionIn' : 'elastic',
'transitionOut' : 'elastic',
'overlayShow' : false,
'showCloseButton' : true,
'width' : 450,
'height' : 585,
'titleShow' : false,
'type' : 'iframe'
});
});
});
enter code here
你试过绑定这个吗? $(“a.example4”)。bind(function(){$(this).fancybox({});});.这可能是问题。 – Ohgodwhy 2012-03-07 10:03:26
我应该把它放入ajax调用吗? – Ismailp 2012-03-07 10:05:23