[英]How can I set a table to be already scrolled at a certain column when i load the html page?
I have a table that has a various number of columns depending on the number of months that are inputted from my database starting from a start_date and towards an end_date. 我有一个表,该表具有不同的列数,具体取决于从数据库中输入的从start_date到end_date的月份数。 I know as a variable the current_date and i need to make the table load with the x-scrollbar right on top of my current_date because the current date can be very far from the beginning of the table and I am supposed to scroll towards it.
我知道current_date是一个变量,我需要用x-scrollbar在我的current_date顶部使表加载,因为当前日期可能离表的开头很远,我应该向它滚动。
Click here to see my table 点击这里查看我的表格
Is there any possibility that I can set the x-scrollbar to start from a certain position? 我可以将x滚动条设置为从某个位置开始吗?
This will help you 这对你有帮助
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>scrollTop demo</title> <style> div.demo { background: #ccc none repeat scroll 0 0; border: 3px solid #666; margin: 5px; padding: 5px; position: relative; width: 200px; height: 100px; overflow: auto; } p { margin: 10px; padding: 5px; border: 2px solid #666; width: 1000px; height: 1000px; } </style> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> </head> <body> <div class="demo"><h1>lalala</h1><p>Hello</p></div> <script> $( "div.demo" ).scrollTop( 300 ); </script> </body> </html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.