Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I auto-scroll to a specific table row?

I have an html page with a header, a table containing 100 items and a footer.

When there is a search, I highlight the row containing the data.

However, if the highlighted row is row 75, the user has to scroll down to find it.

How can I automatically scroll to that row?

I did see scrollTo() but see it only takes axis points.

Any suggestions?

Thanks.

(Using cgi in C, html, css and javascript/jquery)

like image 986
T.T.T. Avatar asked Sep 23 '10 18:09

T.T.T.


1 Answers

You should be able to use scrollIntoView(). (It's on the DOM elements directly.)

Be aware that there are some layout situations where scrolling something on the page can cause IE6 and 7 to decide that random other stuff needs to be scrolled too.

like image 91
Pointy Avatar answered Oct 13 '22 14:10

Pointy