www.webdeveloper.com
Results 1 to 3 of 3

Thread: detecting div tag's scrollbar

  1. #1
    Join Date
    Feb 2003
    Posts
    4

    detecting div tag's scrollbar

    Hello,

    I have the following tag in my html page:

    <div id='divTag' style="overflow: auto; height:'100%'; ">

    When the page loads I'd like to query this div tag to see if the scrollbar is currently visible. I have tried varieties of the following:

    window.document.getElementById("divTag").style.overflow

    but can't seem to find any information of value. Any ideas would be greatly appreciated!

    Thanks!
    Rachel

  2. #2
    Join Date
    Nov 2002
    Posts
    4,473
    It's not that easy, but not too hard:

    ((document.getElementById("divTag").style.offsetHeight > document.getElementById("divTag").style.clientHeight) || (document.getElementById("divTag").style.offsetWidth > document.getElementById("divTag").style.clientWidth))

    If this comparison is true, then the scrollbars should be there.

  3. #3
    Join Date
    Feb 2003
    Posts
    4
    Many thanks Gil, that works like a charm!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles