简体   繁体   中英

Jquery, know width and height of a div with scroll bar

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM