teepusink
teepusink

Reputation: 28882

jQuery - Shadowbox rebinding

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

Upvotes: 6

Views: 1974

Answers (2)

pixeline
pixeline

Reputation: 17974

Actually, i personally had to do:

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

to get shadowbox to acknowledge the DOM change.

Upvotes: 2

teepusink
teepusink

Reputation: 28882

Ah I just found the solution.

Shadowbox.init can't be called 2 times.

So use this instead.
Shadowbox.setup();

Thanks,
Tee

Upvotes: 7

Related Questions