lbholland
lbholland

Reputation: 83

Fancybox onClosed function happening before box opens?

I am trying to fire a second jquery function after my Fancybox is completely closed and the page is back to normal. I tried using the onClosed fancybox attribute, but instead of happening after the box is closed, it's happening before the box opens (on page load, because I have fancybox set to open on page load). What am I missing?

$(document).ready(function () {
    $("a#splash").trigger('click');
    $("a#splash").fancybox({
        'autoScale': false,
        'transitionIn': 'none',
        'transitionOut': 'none',
        'type': 'inline',
        'hideOnContentClick': true,
        'overlayOpacity': 1,
        'onClosed': alert('testing')
 });
});

Upvotes: 1

Views: 3838

Answers (1)

mattsven
mattsven

Reputation: 23263

Try

$(function(){
    $("a#splash").trigger("click");
    $("a#splash").fancybox({
        "autoScale": false,
        "transitionIn": "none",
        "transitionOut": "none",
        "type": "inline",
        "hideOnContentClick": true,
        "overlayOpacity": 1,
        "onClosed": function(){
            alert("Testing! FancyBox closed.");
        }
    });
});

Upvotes: 5

Related Questions