简体   繁体   English

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

[英]Set div scrollbar to specific position

I am using this javascript ( Super Table ) to transform my table in a div to freeze the top header and left column. 我正在使用此javascript( 超级表 )在div中转换我的表,以冻结顶部标题和左侧列。 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. 我以编程方式创建表并将其添加到后面的asp.net代码中的占位符中。

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? 是否可以将一个类添加到表格单元格,然后使用javascript或jquery将水平滚动条移动到当前月份类的表格单元格? If so, how? 如果是这样,怎么办? I am not that great with javascript beyond the basic validation stuff. 除了基本的验证功能外,我对javascript的了解也不是很好。 Any other ideas would be appriciated, too. 任何其他想法也将适用。

Thank you. 谢谢。

Ben

Update 更新资料

This plugin might help you out: http://flesler.blogspot.com/2007/10/jqueryscrollto.html 该插件可能会帮助您: 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. 使用纯HTML可以给它一个id而不是一个类,然后在url的末尾添加“ #id_here”,页面应导航到该单元格。 However, I have never tried that in a scrolling div, so I can't be for sure. 但是,我从未在滚动div中尝试过该操作,因此无法确定。

Example code: 示例代码:

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

Then the link would be: 那么链接将是:

Page.aspx#current-date

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM