views:

118

answers:

2

When I get new elements from load() function can't find the way to attach the function .fancybox (a lightbox plugin) to elements.

I've tried with .live() and .delegate(), but think .fancybox() could not be considered as custom event. I probably miss something... :(

+1  A: 

You must wait until the DOM has been updated after the load. Add a one-shot timer in the success function called by load(). That should do the trick.

Aaron Digulla
+1  A: 

You need to trigger your fancybox after your content has loaded. Use a callback function.

$('#result').load('your/content.html', function() {
      // after load trigger your fancybox 
      alert('Load was performed.');
});

Further information: jQuery .load()

gearsdigital
@gearsdigital: thank you so much! it works as i wanted...
Luciano
You're welcome.
gearsdigital