www.webdeveloper.com
Results 1 to 6 of 6

Thread: Visibility testing

  1. #1
    Join Date
    Mar 2003
    Posts
    8

    Visibility testing

    Is there a way to tell if an object is visible to the user (not scrolled off the screen)?

    Thanks,
    Todd

  2. #2
    Join Date
    Feb 2003
    Posts
    119
    Code:
    <html>
    <head>
    <script language=JavaScript>
    <!--
    if (section.style.visibility == 'visible') alert('I can see it.');
    if (section.style.visibility == 'hidden') alert('Where is it?');
    // -->
    </script>
    <body>
    <div id=section style="visibility:hidden;">YOU CANT SEE ME!</div>
    </body>
    </html>

  3. #3
    Join Date
    Mar 2003
    Posts
    8
    Close, but not quite. I need a way to test to see if an object is on the screen or scrolled off the screen.

  4. #4
    Join Date
    Dec 2002
    Location
    Pensacola
    Posts
    263
    locate the object's X and Y coordinates on the page, and grab the user's availHeight and availWidth, if the object's X/Y values are greater than the availHeight and availWidth, then it's off the screen.

  5. #5
    celebguy_dv Guest

  6. #6
    Join Date
    Mar 2003
    Posts
    8

    For Nicodemas

    I tried looking for a function/method that returns the X/Y coords of a particular object. Do you know of a particular function that returns this info?

    thanks.
    Todd

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