像Twitter对话界面那样设计内部滚动条?

时间:2021-07-30 14:10:54

像Twitter对话界面那样设计内部滚动条?

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?

滚动条是如何创建和设置的?

2 个解决方案

#1


35  

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

看看这个有关更多信息:使用CSS的类似Apple的滚动条

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里面的滚动条才能被定制。

#2


9  

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

#1


35  

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

看看这个有关更多信息:使用CSS的类似Apple的滚动条

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里面的滚动条才能被定制。

#2


9  

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