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/height/

http://api.jquery.com/offset/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM