var opt = { forceAbsolute: false, container: window, // selector of element to center in completed: null };
forceAbsolute
Forces the selected elements to document absolute level. Use this option if the element doesn't center correctly which can happen if its position is relative already. When set the element is removed from its current hierarchy and moved to a child of body.
container
The element in which the selected element(s) are centered. Defaults to the window/viewport. Provide as a jQuery selector.
completed
Optional event handler that is fired when centering is completed. The called handler receives the element that is to be centered as a parameter.
$("#divMessage").centerInClient(); // centers in window
$("#imgLoading").centerInClient( { container: $("#divCustomerPanel") });