Jquery,知道宽度和高度的div与滚动条 [英] Jquery, know width and height of a div with scroll bar

查看:165
本文介绍了Jquery,知道宽度和高度的div与滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述












$ b

任何人都知道有这个值(宽度和高度)?

 < div id =areaclass =divLeftCem area> 
< div id =panelAreaclass =areaBackground
style =width:1004px; height:613px; background:#FFFFFF url('Images / background.png')repeat;> ;
< / div>
< / div>

.area
{
margin-left:10px;
width:1004px;
height:613px;
border:1px solid #AFAFAF; $ b $b overflow:auto;
position:absolute;
top:145px
}



PS:对不起英语。

解决方案

获取元素的 .scrollHeight

  $(。el)。get(0).scrollHeight; 


不言而喻,您可以使用 .scrollWidth 为x轴。



小提琴: http: //jsfiddle.net/spN6n/


I want have width and height of a full div with scroll using JQuery, but i can only have size of visible content and not size of visible + hidden content of scroll bar.

Anyone knows anyway to have this values (width and height)?

<div id="area" class="divLeftCem area">
    <div id="panelArea" class="areaBackground"
        style="width: 1004px; height: 613px; background: #FFFFFF url('Images/background.png') repeat;">
    </div>
</div>

.area
{
    margin-left: 10px;
    width: 1004px;
    height: 613px;
    border: 1px solid #AFAFAF;
    overflow: auto;
    position: absolute;
    top: 145px;
}

PS: Sorry about bad english.

解决方案

Get the element's .scrollHeight:

$(".el").get(0).scrollHeight;

​ It goes without saying you could use .scrollWidth for the x-axis as well.

Fiddle: http://jsfiddle.net/spN6n/

这篇关于Jquery,知道宽度和高度的div与滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆