Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

detecting scrollbars

Status
Not open for further replies.

gormster

Technical User
Mar 1, 2005
27
AU
I know this sounds like something ridiculously simple, but I've yet to find a definitive answer, or indeed any answer that works.

I need to find out if the horizontal scrollbar is present. window.scrollbars.visible doesn't work. I know there is probably a property of something that tells me if the scrollbars are being rendered or not, but damned if I know what it is.
 
That EE thread is a great example of why offering gradings for posts is a really bad idea. It just degenerates into mindless bickering (still - it could have been worse - they could have been clowning around about framesets!)

I think this should work?:

Code:
if (document.body.scrollWidth != document.body.clientWidth) alert('Horizontal scrollbar is present!');

Hope this helps,
Dan

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top