如何将左滚动条放置在 Google Chrome 表格的 tbody 元素上?
我已经研究过这个问题,但找不到解决方案。 该网站是一个 RTL 网站,所以我想要左侧的滚动条。 我见过一些可以完成此任务的黑客,除非我真正需要它。
表格的 Tbody 元素需要向下滚动而不会使标题行消失。 我可以将滚动条放在主体的右侧,但不知道如何将其移动到左侧。
任何如何让 TBody 的滚动条位于左侧的想法将不胜感激。
我很幸运它只需要在 Google Chrome 上运行。
I have looked into this issue and can not find a solution.
The web site is a RTL site so I would like the scrollbars on the left.
I have seen some hacks that can get this done except where I really need it.
The Tbody element of the table needs to scroll down without the header row disappearing.
I can get the scrollbar on the right hand side of the tbody but have no idea how to move it to the left.
Any ideas how to get the TBody's scrollbar on the left hand side will be much appreciated.
I am lucky it only has to work on Google Chrome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
它不能用 CSS 改变。例如,有些浏览器(iPhone、Android)没有滚动条。滚动条的位置完全取决于用户的系统,而不是网页。
你可以使用Javascript来模仿你想要的东西。制作一个可拖动的滚动条替换,将其放置在左侧,并根据用户拖动“滚动条”时调整隐藏的溢出。
尝试用谷歌搜索“jquery滚动条”或“javascript滚动条”。
这是滚动的一个有趣的替代方法...拖动(类似于在谷歌地图中拖动地图的方式):
http://plugins.jquery.com/project/MapScroller
还有另一种选择,这是一个脚本计算用户滚动条的宽度:
http://plugins.jquery.com/project/ba-jquery-scrollbarwidth-plugin
您可以计算宽度,然后使用overflow:hidden隐藏滚动条,然后在左侧添加一个div,其高度与要滚动的框相同,宽度与用户的滚动条相同,然后编写一个脚本将右侧框滚动到与左侧位置相同,从而模仿内置系统滚动条。
有无限的可能性,只需使用谷歌找到您需要的东西并发挥创意。 ;)
但是,我认为这正是您正在寻找的:
http://baijs.nl/tinyscrollbar/
正如您在示例中看到的,滚动条由元素组成。如果您愿意,可以将它们放置在左侧。
或许,还有这个:
http://plugins.jquery.com/project/tbodyscroll
正是您所需要的。 ;)
看看这个,这是一个有效的示例:
http://jsfiddle.net/trusktr/xQSxJ/
我会尽快更新它以与表仅供我自己练习。 ;)
通常,您只能找到部分解决方案,并且需要即兴发挥才能提出完整且独特的解决方案。 :) 祝你好运。
It can't be changed with CSS. For example, there are browsers (iPhone, ANdroid) that don't have scroll bars. The scroll bar position depends entirely on the user's system, not the web page.
You can use Javascript to imitate what you want. Make a draggable scroll bar replacement, place it on the left, and adjust the hidden overflow according while the user drags the "scrollbar".
Try googling for "jquery scrollbar" or "javascript scrollbar".
Here's a an interesting alternative to scrolling... Dragging (similar to how you drag maps in google maps):
http://plugins.jquery.com/project/MapScroller
And yet another alternative, here's a script that calculates the width of the users scroll bar:
http://plugins.jquery.com/project/ba-jquery-scrollbarwidth-plugin
You can calculate the width, then hide the scroll bar with overflow:hidden then add a div on the left with same height as the box you want to scroll and same width as the user's scrollbar, then write a script that scrolls the right box to the same position as the one on the left, thus imitating built in system scrollbars.
There's endless possibilities, just use google to find what you need and get creative. ;)
But, I think this is exactly what you're looking for:
http://baijs.nl/tinyscrollbar/
As you can see in the examples, the scrollbar is made of elements. You can position them on the left if you'd like.
Perhaps that, along with this:
http://plugins.jquery.com/project/tbodyscroll
is EXACTLY what you need. ;)
Check this out, here's a working example:
http://jsfiddle.net/trusktr/xQSxJ/
I'll update it soon to work with a table just for my own exercise. ;)
Often times you will only find partial solutions and will need to improvise to come up with a complete and unique solution. :) Good luck.
正如前面提到的。这不是 CSS 问题,但是,正如 trusktr 所说,您可以创建一个自定义的 javascript 滚动条。基本上你设置它是这样的。
然后,您在滚动条内创建一个可拖动的对象,该对象的位置会更改框架内内容的相对位置。
As mentioned earlier. This is not a CSS issue, you could however, as trusktr stated, create a cusom javascript scrollbar. Basically you set it up something like this.
Then you create a draggable object inside the scrollbar which position changes the relative position of the content inside the frame.
对于 CSS,请使用“direction:rtl;”,但结果在不同浏览器中可能会有所不同。
For CSS use "direction:rtl;", however results may vary in different browsers.