在动态内容触发的fancybox内容、动态、fancybox

2023-09-10 20:10:21 作者:你给我的都是‘等待’

我的< A>从阿贾克斯调用后标签,它有呼吁的fancybox功能加载。一旦点击该链接,模态窗口不会出现。我试着用< A>在一个静态的方式和它的作品,而不是通过动态code。我还注意到,在查看源在我的IE浏览器,标记并非present。任何帮助吗?谢谢!

这code会从服务器端(我用java)AJAX调用后动态创建。即时通讯使用类作为我的链接到jQuery的功能,因为这些标签可以使用相同的类名的几个实例:

 <一类=链接的href =#任务称号=详细信息>查看详情< / A>
    < D​​IV的风格=显示:无;>
        < D​​IV ID =任务的风格=宽度:400像素,高度:100像素;溢出:汽车;>
            来自服务器的一些数据。
        < / DIV>
    < / DIV>
 

这是我的fancybox功能:

  $(a.link)。的fancybox({
        titlePosition':'里面',
        transitionIn':'无',
        transitionOut':'无'
});
 
如何创作出爆款的动态内容 了解五个技巧,轻松写出爆款

解决方案

的fancybox从V2.0开始用活来绑定单击事件,所以它会为动态创建的元素了。

My <a> tag which has the call for the Fancybox function will load after calling from ajax. Upon clicking on the link, the modal window wont show up. I tried using the <a> in a static way and it works, but not through dynamic code. I also noticed that upon viewing "Source" in my ie browser, the tag is not present. Any help? Thanks!!

this code will be created dynamically after calling ajax from the server side (I'm using java). Im using class as my link to the jquery function because the tags can be several instances with the same class name:

 <a class="link" href="#task" title="Details">View details</a>
    <div style="display: none;">
        <div id="task" style="width:400px;height:100px;overflow:auto;">
            some data from the server.
        </div>
    </div>

This is my fancybox function:

$("a.link").fancybox({
        'titlePosition' : 'inside',
        'transitionIn'  : 'none',
        'transitionOut' : 'none'
}); 

解决方案

fancyBox starting from v2.0 uses "live" to bind click event, so it will work for dynamically created elements, too.