The popup plugin has the following custom events:
popupbeforeposition
$( ".selector" ).bind({ popupbeforeposition: function(event, ui) { ... } });
This event is triggered when the popup has completed preparations for appearing on the screen. At this point the popup has not started the animations and it has not yet calculated the coordinates where it will appear on the screen. Handling this event gives an opportunity to modify the content of the popup before it appears on the screen. For example, the content can be scaled or parts of it can be hidden or removed if it is too wide or too tall.
popupafteropen
$( ".selector" ).bind({ popupafteropen: function(event, ui) { ... } });
This event is triggered when the popup has completely appeared on the screen, meaning that all associated animations have completed.
popupafterclose
$( ".selector" ).bind({ popupafterclose: function(event, ui) { ... } });
This event is triggered when the popup has completely disappeared from the screen, meaning that all associated animations have completed.