Search code examples
javascriptfancybox

How to get a callback in fancyBox


I want to get a callback in fancyBox when I use the open function:

$.fancybox.open($("#some_block"));
// or
$.fancybox.open("my text");

How can I get a callback after the show block?


Solution

  • You can try to use afterShow handler. http://jsfiddle.net/nt7x48yr/1/

    $.fancybox.open($("#some_block"), {
      afterShow: function() {alert('afterShow');}   
    });
    // or
    $.fancybox.open("my text", {
      afterShow: function() {alert('afterShow');}   
    });