如何自动滚动到特定的表格行? [英] How do I auto-scroll to a specific table row?

查看:109
本文介绍了如何自动滚动到特定的表格行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带页眉的html页面,一个包含100个项目和页脚的表格。



当有搜索时,我突出显示包含数据的行。然而,如果突出显示的行是第75行,用户必须向下滚动才能找到它。



我怎样才能自动滚动到那一行?



我确实看到 scrollTo(),但看到它只需要轴点。



有什么建议吗?

谢谢。

(在c,html,css和javascript / jquery中使用cgi)

解决方案

您应该可以使用 scrollIntoView()。 (它直接在DOM元素上)。



请注意,有一些布局情况,在页面上滚动某些内容可能导致IE6和7决定随机的其他东西需要也滚动。


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)

解决方案

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.

这篇关于如何自动滚动到特定的表格行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆