Problem with jQuery Colorbox

I have a website that uses jQuery and colorbox ajax.

Inside the div "#content" there are some links to other pages that open perfectly with colorbox.

If I reload the contents of this div using ajax jquery, then the links will not pop up using the colorbox effect.

I tried to create a function that I would call whenever I call a function that modifies the contents of div #content but no luck. I know that I have to reuse / reload colorbox in the DOM every time I load something new on a page containing rel = "colorbox", but I cannot figure out how. I call it inside

function showcategory() { reinit(); ... } function reinit() { $('a[rel*=colorbox]').colorbox() ; } 
+1
source share
2 answers

try connecting a handler using live instead of bind . This withstands content reloads in divs

api doc for live here

+1
source

You will need to use the live () or delegate method for dynamically generated content events.

+1
source

All Articles