JQuery know the width and height of a div with a scroll bar

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

Does anyone know to have these 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 for the bad English.

+6
source share
1 answer

Get the .scrollHeight element:

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

Needless to say, you could use .scrollWidth for the x axis.

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

+10
source

Source: https://habr.com/ru/post/916271/


All Articles