问题描述
我不知道Facebook上的自定义滚动条是如何做的。
I'm wonder how the custom scrollbar on Facebook has been made.
它只是CSS或一些javascript吗?
Is it only css or some javascript as well?
如果是,我可以知道代码的样子吗?
If yes can i have an idea of what the code looks like?
这个问题是特定于Facebook滚动条样式,只需要一个自定义滚动条
This question is specific to Facebook scrollbar style and not how to simply have a custom scrollbar
推荐答案
应该可以帮助您开始使用。长篇小说,自定义css风格的div与JavaScript结合使用,捕获自定义div上的点击和拖动事件。有关这些事件的是滚动内容的任何div的自定义滚动已附加的方法。
This link should get you started. Long story short, a custom css-styled div is used in conjunction with JavaScript to catch click-and-drag events on the custom div. Wired up to these events are methods that scroll the contents of whatever div the custom-scroller has been attached to.
我所有关于学习经验 - 但后你已经学会了它的工作原理,我建议使用一个库(有很多)来做。
I'm all about the learning experience -- but after you've learned how it works, I recommend using a library (of which there are many) to do it. It's one of those "don't reinvent" things...
编辑
如果你想完全跳过学习阶段,jassi9911向一个jQuery插件发布了,该插件使用起来非常简单。好东西。
EDITIf you want to skip the learning phase altogether, jassi9911 posted a link to a jQuery plugin that's dead-simple to use. Good stuff.
这篇关于如何在div(Facebook风格)上创建自定义滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!