码迷,mamicode.com
首页 > 其他好文 > 详细

将标签元素的高设为屏幕的百分比

时间:2016-02-17 12:43:12      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:

html部分:

<body>

<div id="margin_box"></div>

</body>

 

jquery部分:

<script>

     $(function(){
             var percent =0.15;
             $("#margin_box").css("height",window.document.body.clientHeight*percent)

     })

</script>

 

将标签元素的高设为屏幕的百分比

标签:

原文地址:http://www.cnblogs.com/crizygo/p/5167012.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!