Search code examples
jqueryblockuishowmodaldialogjquery-blockui

blockUI not working with showModalDialog


How do I get the blockUI overlay to display before the showModalDialog is called?

$("button").click(function(){
    $.blockUI({ message: '' });    
    window.showModalDialog("http://www.google.com");
    $.unblockUI();
}); 

http://jsfiddle.net/dTG82/


Solution

  • Because of the animation the $.blockUI function is not synchronous. You will have to wait for the animation to complete, or set fadeIn: 0.

    $.blockUI({ message: '', fadeIn: 0 });
    

    See working example