且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

加载动态的AJAX的内容转换成的fancybox

更新时间:2023-12-05 09:57:16

我结束了加载内容到一个隐藏的容器在页面上,然后显示在的fancybox的内容。

I ended up loading the content into a hidden container on the page, and then displaying that content in a Fancybox.

$('#button').on('click', function(){    
   var nzData = '/url.com?Zip=8000 #module';

     $('#foo').load(nzData, function(){
       var foo = $('#foo').html(); 
       $.fancybox(foo);
    });

});

这不是很pretty的,我承认这一点,但它是我可以使它工作的唯一途径。我今天早上,谁曾使出了类似的问题相同的解决方案跟其他开发人员。

It's not very pretty, I admit it, but it's the only way I could make it work. I talked to another developer this morning, who had resorted to the same solution in a similar problem.

不过,必须有一个更好的解决方案。如果任何人都知道,我很乐意听到它!

Still, there must be a better solution. If anyone know, I'd love to hear it!