jqeury: best way to place dom element in the center of viewport

Posted by Anthony Koval' on Stack Overflow See other posts from Stack Overflow or by Anthony Koval'
Published on 2010-04-27T14:20:18Z Indexed on 2010/04/27 14:23 UTC
Read the original article Hit count: 258

Filed under:
|

hello! i'm looking for a proper way of placing popup div-elemnt in the center of current view area. for example: we have some div element with {display:none; position:absolute} and few buttons, one on the top of document, second in the center and last one, somewhere in the bottom. By clicking on any of this button, div should appear in the center of current viewing area

$(".btnClass").click(function(){
    //some actions for positioning here
    $(div_id).show()  
})

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about html