滚动条在div滚动而不是页面滚动条 [英] Scrollbar in div scroll instead of page scrollbar

查看:139
本文介绍了滚动条在div滚动而不是页面滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在建立我的网站,我可以遇到一个小问题。
我有一个固定高度和溢出的div:auto ;.网站的高度将调整自己,以适应页面完美,所以你不会得到一个滚动条。我的问题是:我可以通过在页面中发生的滚动事件,并将其重定向到滚动条?所以换句话说,当我滚动,而不是页面,但是我的div中的滚动条必须移动。



我希望我清楚,如果没有,请问


$ b 起来像一个魅力!非常感谢大家的建议^^。

解决方案

这应该可以工作,

  div {
width:150px;
height:150px;
overflow:scroll;
}


I was building my site I can came across a little problem. I have a div with a fixed height and overflow:auto;. The height of the website will adjust itself to fit the page perfectly so that you dont get a scrollbar. My question is: Can I pass through the scroll event that happends in the page and redirect it to the scrollbar ? So in other words, when I scroll, not the page, but the scrollbar inside my div has to move.

I hope I made myself clear, if not, please ask for some more information.

With kindly regards, Bob

FIXED: The solution Andy brought up worked like a charm! Thank you and thanks all of you for your suggestions ^^.

解决方案

This should work, I have used it in the past:

div {
        width:150px;
        height:150px;
        overflow:scroll;
    }

这篇关于滚动条在div滚动而不是页面滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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