jQWidgets Forums
jQuery UI Widgets › Forums › Dialogs and Notifications › Window › Positioning window in the center of viewport.. › Reply To: Positioning window in the center of viewport..
For the window always to be positioned in screen center, when scrolled or not ecrolled, set the window div style to the following:
style=”position: fixed; left: 50%; top: 50%;”
Here is a complete example in which the winMsgTxt is set in runtime:
<div id=”winMsg” style=”position: fixed; left: 50%; top: 50%;”>
<div>
<div id=”winMsgTxt”></div>
<div>
<div style=”position: absolute; bottom: 10px; right: 10px; margin-top: 10px;”>
<input type=”button” id=”btnMsgOk” value=”OK” /><input type=”button” id=”btnMsgCancel” value=”Cancel” />
</div>
</div>
</div>
</div>