将div滚动条设置到特定位置

发布于 2024-09-14 17:49:38 字数 377 浏览 5 评论 0原文

我正在使用这个 javascript (Super Table) 将我的表格转换为 div 以冻结顶部标题和左栏。可滚动区域的列包含与特定月份和年份相对应的文本框。我希望水平滚动位置能够匹配当前月份和年份。我以编程方式创建该表,并将其添加到后面的 ASP.NET 代码中的占位符中。

是否可以向表格单元格添加一个类,然后使用 javascript 或 jquery 将水平滚动条移动到具有当前月份类的表格单元格?如果是这样,怎么办?除了基本的验证之外,我对 javascript 不太了解。任何其他想法也将受到重视。

谢谢。

I am using this javascript (Super Table) to transform my table in a div to freeze the top header and left column. The scrollable area has columns with textboxes that corrospond to a specific month and year. I would like to have the horizontal scroll position to match the current month and year. I create the table programmatically and add it to a placeholder in an asp.net code behind.

Is it possible to add a class to a table cell and then use javascript or jquery to move the horizontal scroll bar to the table cell with the current month class? If so, how? I am not that great with javascript beyond the basic validation stuff. Any other ideas would be appriciated, too.

Thank you.

Ben

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

原谅过去的我 2024-09-21 17:49:38

更新

这个插件可能会帮助你:http://flesler .blogspot.com/2007/10/jqueryscrollto.html


使用纯 HTML,您可以给它一个 id 而不是一个类,然后在 url 末尾添加“#id_here”,页面应导航到细胞。但是,我从未在滚动 div 中尝试过,所以我不能确定。

示例代码:

<td id="current_date"></td>

那么链接将是:

Page.aspx#current-date

Update

This plugin might help you out: http://flesler.blogspot.com/2007/10/jqueryscrollto.html


Using purely HTML you can give it an id instead a class and then at the end of the url you would add "#id_here" and the page should navigate to the cell. However, I have never tried that in a scrolling div, so I can't be for sure.

Example code:

<td id="current_date"></td>

Then the link would be:

Page.aspx#current-date
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文