如何使滚动DIV与滚动条外面的div像在Facebook上? [英] How to make scrollable DIV with scrollbar outside div like on facebook?

查看:134
本文介绍了如何使滚动DIV与滚动条外面的div像在Facebook上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想有一个可滚动的div,但滚动条应该在浏览器的右侧默认(但不是在右侧的div)。我在Facebook上看到了(ceter div - contentArea由右侧浏览器滚动条滚动)。

I would like to has a scrollable div but scrollbar should be on the right side of browser as default (but not on the right side of div). I've seen that on facebook (ceter div - contentArea is scrolled by right side browser scrollbar).

推荐答案

它是通过使所有不滚动的内容具有位置的固定。这样,本地浏览器滚动条将只显示滚动中心区域,而实际上是固定位置的其余页面。

The way Facebook does it is by having all the content that doesn't scroll have a position of fixed. This way the native browser scrollbar will appear to scroll the center area only, while it's actually the rest of the page that is fixed in position.

这是一个非常简单的例子:

A very simple example of this:

http://jsfiddle.net/tcaVN/

现在想象以上,但是所有不可滚动的项目设置如 #header

Now imagine the above, but with all non-scrollable items setup like the #header.

EDIT

下面是一个稍微复杂的例子,包含三列:

Here is a slightly more complex example, with three columns:

http://jsfiddle.net/tcaVN/1/

这篇关于如何使滚动DIV与滚动条外面的div像在Facebook上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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