jQuery实现图层居中

<script>
$(“#chatbox”).each(function(i,o){
$(o).css(“left”,(($(document).width())/2-(parseInt($(o).width())/2))+”px”);
$(o).css(“top”,(($(document).height())/2-(parseInt($(o).height())/2))+”px”);
})
</script>
<div id=”chatbox” style=”position:absolute;z-index:100;background-color:red;”></div>

Leave a Reply

Your email address will not be published.