jQuery - Shadowbox rebinding

天涯浪子 提交于 2020-01-11 08:39:28

问题


How do I bind / initialize Shadowbox to content loaded by jQuery using AJAX?
Right now shadowbox works when I first come into the site.

However, when I swap the content with a new one loaded through AJAX, these new batch of content doesn't do the shadowbox popup, instead it just redirect to the content.

I have Shadowbox.init(shadowbox_conf); in the success but it doesn't seem to do the trick.

Thanks,
Tee


回答1:


Ah I just found the solution.

Shadowbox.init can't be called 2 times.

So use this instead.
Shadowbox.setup();

Thanks,
Tee




回答2:


Actually, i personally had to do:

        Shadowbox.clearCache();
        Shadowbox.setup();

to get shadowbox to acknowledge the DOM change.



来源:https://stackoverflow.com/questions/2518745/jquery-shadowbox-rebinding

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!