Jayyrus
Jayyrus

Reputation: 13051

How to call javascript function after fancybox terminate to load

i'm call fancybox in this way:

$(".add_exc").fancybox({
    maxWidth    : 1000,
    maxHeight   : 600,
    fitToView   : false,
    height      : '70%',
    autoSize    : true,
    closeClick  : false,
    openEffect  : 'none',
    closeEffect : 'none'
});

where .add_exc is:

<a class="add_exc fancybox.ajax" href="ajax_content.php">
    <img src="click.png" />
</a>

in the ajax content i have some checkboxes and i need to check inside the parent window if some elements are present so that i can check the checkbox inside fancybox.

If i load javascript content inside the ajax content, it will be discarded.

How can i solve? thanks!!

Upvotes: 1

Views: 3806

Answers (1)

JFK
JFK

Reputation: 41143

You could try with the fancybox callback afterLoad

$(".add_exc").fancybox({
    // all other API options
    closeEffect : 'none',
    afterLoad : function(){
     myFunction();
     // or some jQuery
     $variable = $(".selector:checked").val();
    }
});

Upvotes: 1

Related Questions