Posts Tagged ‘jQuery’

Closing a fancybox

Scenario:

We are using a fancy box to present a form to the user to enter some data. Once this data is entered and the user submits the form, if the processing was successful, we want to show a message to the user and then close the fancybox (which is the form).

Code:

HTML

<a href="<%= ResolveUrl("~") %>RegForm" class="iFrameRegister" title="">Register</a>

Open the form:

$("a.iFrameRegister").fancybox({
        ‘frameWidth’: 400,
        ‘frameHeight’: 400
    });

Close the form:

parent.$.fn.fancybox.close();

Technorati Tags: ,,
Advertisements