I have a table
with many rows, this table is bound in a div
which had a fixed height, so I get a scroll-bar for my table. Now how can I find out which rows are in view?
I have unique ids given to each row. I am not using any library, so looking for a solution in pure JavaScript and IE
I have a button on the page whose onclick should tell me if the row is scrolled in view or not
function check()
{
var row5 = document.getElementById("r5");
var b = document.getElementById("boundary");
if(!NeedThisFunction(row5,b))
alert("not in view");
else
alert("in view");
}
<button onclick="check()" >Check</button >
<div id="boundary" style="overflow:scroll;height:100px">
<table border="1" >
<tr id="r1">
<td>row 1 col1</td>
<td>row 1 col2</td>
<td>row 1 col3</td>
<td>row 1 col4</td>
</tr>
...
<tr id="r100">
<td>row 100 col1</td>
<td>row 100 col2</td>
<td>row 100 col3</td>
<td>row 100 col4</td>
</tr>
</table>
</div>