Click to See Complete Forum and Search --> : Visibility testing


pixelstick
03-03-2003, 10:53 PM
Is there a way to tell if an object is visible to the user (not scrolled off the screen)?

Thanks,
Todd

dabush
03-03-2003, 11:03 PM
<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>

pixelstick
03-04-2003, 01:23 AM
Close, but not quite. I need a way to test to see if an object is on the screen or scrolled off the screen.

Nicodemas
03-04-2003, 02:46 AM
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.

celebguy_dv
03-04-2003, 03:25 AM
http://banners.dollarmachine.com/pic/2014000/hal001.gif (http://www.kinkyceleb.com/1261795520)

pixelstick
03-06-2003, 01:18 PM
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