problem getting mouse coords in scrolled area from overflow: auto

J

Jedrin

I have a div with a table in it as shown below. The 'overflow: auto'
causes the table to appear in it's own little scrolled area with a
scroll bar as we want since it is very large. However when a mouse
down event occurs, we want to know the position of the mouse relative
to the table in it's scrolled area. I'm not sure how this can be
done ? I know there is clientX,clientY and pageX,pageY as well as
window.pageXOffset. But the later is for scrolling of the whole page
and not the scrolled area. What to try ?

.grid_overflow_class {
width: 100%;
overflow: auto;
}

<div class='grid_overflow_class'>

<table>
...
....
etc ..
</table>

</div>
 
T

Thomas 'PointedEars' Lahn

Jedrin said:
I have a div with a table in it as shown below. The 'overflow: auto'
causes the table to appear in it's own little scrolled area with a
scroll bar as we want since it is very large.

Consider setting overflow:auto to the `tbody' element instead.
Cf. said:
However when a mouse down event occurs, we want to know the position
of the mouse relative to the table in it's scrolled area. I'm not sure
how this can be done ? I know there is clientX,clientY and pageX,pageY
as well as window.pageXOffset. But the later is for scrolling of
the whole page and not the scrolled area. What to try ?

The `scrollTop' property of the scrollable element. Already discussed
several times before.

<http://jibbering.com/faq/#posting>


HTH

PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top