jquery 设置div在浏览器的位置
<script type="text/javascript"> var offset = $("#health_alert").offset(); var alert_top = offset.top; var window_height =$(window).height(); var alert_hight = $("#health_alert").outerHeight(); var alert_top = ( window_height - alert_hight )/ 2; $("#health_alert").offset({ top: alert_top}); //alert(alert_hight); </script>
http://api.jquery.com/offset/