左侧的HTML元素滚动条 [英] HTML element scrollbar on the left

查看:109
本文介绍了左侧的HTML元素滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:

有没有用css或js在左侧而不是在右侧显示元素的滚动条的方式?我不需要交叉浏览器的方式,我只需要在Firefox上。

is there a way with css or js to show the scrollbar of an element on the left instead of on the right? i don't need a crossbrowser way i need it only on Firefox.

推荐答案

如果您希望将方向保留为 - 但是仍然想违反用户必须滚动条的每一个期望,那么你可以使用JavaScript来破解它。

只需在内容的左侧创建一个1px宽的div。让它与您想要滚动的内容高度相同。然后,将 onscroll 事件连接到该div,并且每当用户滚动该div时,您都可以手动滚动内容区域。

If you want the direction to be left-to-right, but still want to violate every expectation a user has to scrollbars, then you can hack it using javascript.
Simply create a 1px wide div on the left side of your content. Have it be the same height as the content which you want to scroll. Then hook up an onscroll event to that div and whenever the user scrolls that div, you can scroll the content area manually.

一些进一步的提示:主要内容区域需要 overflow:hidden ,您可以使用 margin-top 假冒滚动。

Some further tips: main content area needs to have overflow:hidden and you can use negative values for margin-top to fake the scrolling.

这篇关于左侧的HTML元素滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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