Re: viewable coordinates of an element
- From: steven acer <dudesterr@xxxxxxxxx>
- Date: Fri, 26 Oct 2007 09:44:34 -0700
i need the coordinates to display a tool tip div on that text field if
that makes more clear
On Oct 26, 7:28 pm, steven acer <dudest...@xxxxxxxxx> wrote:
lol sorry about that flubbed intro ! it's just that i'm really new to
javascript and web design as a whole, i'm just writing a small
online help module for an application i'm currently working on so i
might use the wrong terms sometimes.
anyways, i hope i was able to explain my situation here because what
you're suggesting simply yields
scrollLeft=0 and scrollTop=0 in FF 2.0 and in IE 7.
let me reform just a bit:
here's my code first
<div id="content">
..
<input type="text" id="dec_cod"
onKeyDown="showHelp(event);return(false);"/>
</div>
when the text field is scrolled into view either as a result of a
user's action or via javascript, i want
to calculate the coordinates of the point in the page that sits on the
top left corner of the newely visible text.
i have tried calculating the offsetTop of the element with respect to
the HTML element but it yielded the exact Y coordinate on the page.
dammit i guess this is an even more clunky explanation, anyway thanks
for your time man.
Thomas 'PointedEars' Lahn wrote:
steven acer wrote:
i have an INPUT element inside a scrolling DIV.initially the element's
position is off screen or off the viewable part of it
and has coordinates as follows X=223 Y=2225.
Is there a way to like when i scroll the DIV to this element,
calculate the "viewable" coordinates if the element with respect to
the page.
example: when i scroll to it i would expect a Y (if vertically ) value
<= page height but i always get the offscreen coordinates
You are looking for the scrollLeft and scrollTop properties of the DIV ...
and someone who teaches you how to write text in an easily legible way.
http://jibbering.com/faq/
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
.
- References:
- viewable coordinates of an element
- From: steven acer
- Re: viewable coordinates of an element
- From: Thomas 'PointedEars' Lahn
- Re: viewable coordinates of an element
- From: steven acer
- viewable coordinates of an element
- Prev by Date: Re: IE does not load image when it is specified from JS
- Next by Date: Re: Possibly OT. IE6 and background colors..
- Previous by thread: Re: viewable coordinates of an element
- Next by thread: Re: viewable coordinates of an element
- Index(es):
Relevant Pages
|
Loading