Misha Moroshko
Misha Moroshko

Reputation: 171321

Javascript: How to identify if a "div" is overflowed?

I have a div with overflow: auto (a vertical scroll bar appears if the div contains a lot info).

How could I identify at some point if the vertical scroll bar appears or not ?

Upvotes: 1

Views: 711

Answers (2)

Saeb Amini
Saeb Amini

Reputation: 24380

It's been answered here

Upvotes: 1

sje397
sje397

Reputation: 41812

From http://bytes.com/topic/javascript/answers/157924-detect-if-scrollbars-visible-inside-div:

if (document.getElementById('divID').scrollHeight > document.getElementById('divID').clientHeight)
{
//a vertical scroll bar is present
}
else
{
//a vertical scroll bar is NOT present
}

Upvotes: 3

Related Questions