使用jQuery彩盒问题 [英] Problem with jQuery Colorbox
问题描述
我有一个使用AJAX jQuery和颜色框一个网站。
在div#内容,也有一些链接到其他网页,打开精细使用颜色框。
如果我用ajax jquery的重新加载div的内容,然后使用链接颜色框效果了惯于弹出。
我试图创建一个功能,我会打电话每当我打电话,改变DIV#内容的内容的功能,但没有运气。我知道,我必须重新初始化/重新加载颜色框,以DOM,每次我加载了一个包含相对=颜色框一些新的页面,但我不能弄明白how.I称这里面
函数showcategory(){
reinit的();
...
}
功能reinit的(){
$('一[REL * =颜色框]')颜色框()。
}
尝试使用附加的处理程序生活
,而不是绑定$ C的$ C>。这幸存的内容,在重载的div
的API文档活是这里
I have a website that uses ajax jquery and colorbox.
Inside the div "#content" there are some links to other pages that open fine using colorbox.
If I reload the content of that div using ajax jquery , then the links wont popup using colorbox effect anymore.
I tried to create a function that I would call whenever I call the function that changes the contents of div #content , but no luck . I know that I must reinit/reload the colorbox to DOM everytime I load something new to the page that contains rel="colorbox" ,but I cant figure it out how.I call this inside
function showcategory() {
reinit();
...
}
function reinit() {
$('a[rel*=colorbox]').colorbox() ;
}
try to attach your handler using live
instead of bind
. This survives content-reloads in the divs
the api doc for live is here
这篇关于使用jQuery彩盒问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!