在动态内容触发的fancybox [英] Triggering Fancybox in dynamic content

查看:265
本文介绍了在动态内容触发的fancybox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的< 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.

这篇关于在动态内容触发的fancybox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆