jackmoore/colorbox — Issue #148: Setting colorbox in a .load-callback in Facebook Tab/Canvas
Author: dansurfrider
Created: 2011-12-18 23:08:51+00:00
State: open

I'm having a little issue with the colorbox when using it in a facebook tab/canvas.

Basically I load another file (that contains a few images) with ajax (jQuery) into my canvas page and I want to let colorbox open those pictures. It all works fine when I attach the colorbox in the callback of my ajax .load as long as I'm not in the facebook canvas.

But as soon as I open the page in facebook, it won't open colorbox anymore. All other jQuery functions are working though.

Code-Example

$('#slider').load('content.php', { ajax: 'on' }, function(e) {
$('.gallery').colorbox({rel:'gal'});
});

I found a solution to make it work - I need to define the colorbox in the file that is getting loaded with ajax. But I don't understand why it's not working in the callback and I don't think it's a very nice solution. Before I want to move on and develop further things in my fb-canvas, I need to know why this is happening.