Search code examples
javascriptjqueryfacebox

Facebox only works once


Am binding my Facebox requests just how the documentation says on the Facebox website.

But after I click one of the div.comment's the Facebox request doesn't work again.

The code I am using is just below and further down is my error.

$(document).ready(function() {
    $('.comment').bind('click', function() {
        $.facebox({ajax: '/project/cake_app/comment/tweets/' + $(this).attr('id')});
    }); 
});

Error:

Uncaught TypeError: Object function (a,b){return new d.fn.init(a,b,g)} has no method 'facebox'

Solution

  • I solved my problem by switching from Facebox to Fancybox, it seems their is a bug with Facebox that is unbinding the event after it is used once.