Html 像 Twitter 对话界面一样设计一个内部滚动条?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7713599/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Styling an inner scrollbar like the Twitter conversation interface?
提问by Mattis
The scroll bar can be seen in the side-panel when you click on a tweet and the conversation linked to the tweet is long enough.
当您单击推文并且链接到该推文的对话足够长时,可以在侧面板中看到滚动条。
How is the scroll bar created and styled?
滚动条是如何创建和样式化的?
回答by thirtydot
They're using ::-webkit-scrollbar
and the associated pseudo-elements, which only work in WebKit browsers (which is fine, because this is just aesthetics).
他们正在使用::-webkit-scrollbar
和关联的伪元素,这些伪元素只能在 WebKit 浏览器中使用(这很好,因为这只是美学)。
Take a look at this for more information: Apple-like scrollbars using CSS
查看更多信息:Apple-like scrollbars using CSS
I've taken the CSS that Twitter is using, see: http://jsbin.com/ubasew
我采用了 Twitter 正在使用的 CSS,请参阅:http: //jsbin.com/ubasew
#doc ::-webkit-scrollbar{width:9px;height:9px;}
#doc ::-webkit-scrollbar-button:start:decrement,#doc ::-webkit-scrollbar-button:end:increment{display:block;height:0;background-color:transparent;}
#doc ::-webkit-scrollbar-track-piece{background-color:#FAFAFA;-webkit-border-radius:0;-webkit-border-bottom-right-radius:8px;-webkit-border-bottom-left-radius:8px;}
#doc ::-webkit-scrollbar-thumb:vertical{height:50px;background-color:#999;-webkit-border-radius:8px;}
#doc ::-webkit-scrollbar-thumb:horizontal{width:50px;background-color:#999;-webkit-border-radius:8px;}
The #doc
is as Twitter had it, and it's there so that only scrollbars inside #doc
are customised.
该#doc
是像Twitter有它,它的出现使只有滚动条之内#doc
被定制。
回答by no.
I believe they are using a jQuery plugin or one created by themselves, either way it's something similar to jScrollPane
我相信他们使用的是 jQuery 插件或自己创建的插件,无论哪种方式,它都类似于 jScrollPane
http://www.kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html
http://www.kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html