JavaScript 滚动条建议

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4967521/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 15:30:41  来源:igfitidea点击:

JavaScript scrollbar recommendations

javascriptscrollbarmcustomscrollbar

提问by TimFoolery

I'm really disappointed that I can't customize Firefox's scrollbar, but now I am looking for alternatives. Listed below are the best that I've found, but I figured I should ask for opinions and perhaps links to even better ones!

我真的很失望我无法自定义 Firefox 的滚动条,但现在我正在寻找替代方案。下面列出的是我发现的最好的,但我想我应该征求意见,也许还有更好的链接!

http://manos.malihu.gr/jquery-custom-content-scroller(looks great, supports content changes)

http://manos.malihu.gr/jquery-custom-content-scroller(看起来不错,支持内容更改)

http://baijs.nl/tinyscrollbar/(looks decent, supports content changes, 100 lines of code, etc.)

http://baijs.nl/tinyscrollbar/(看起来不错,支持内容修改,100行代码等)

http://johnford.is/examples/script.aculo.us/index.html(image examples look good, mouse wheel support available)

http://johnford.is/examples/script.aculo.us/index.html(图像示例看起来不错,鼠标滚轮支持可用)

Are these the best, or does anyone have a recommendation?

这些是最好的,还是有人有推荐?

回答by Tim Down

My recommendation: stick with the scrollbars provided by the browser. They may not look exactly how you want, but they will work better than any JavaScript replacement, will be consistent with scrollbars in other applications in the user's OS, and will work when JavaScript is turned off. You also avoid effort now (easier development) and later (no maintenance).

我的建议:坚持使用浏览器提供的滚动条。它们可能看起来不像您想要的那样,但它们会比任何 JavaScript 替代品更好地工作,将与用户操作系统中其他应用程序中的滚动条保持一致,并且在 JavaScript 关闭时也能工作。您还可以避免现在(更容易开发)和以后(无需维护)的努力。

回答by Oralet

The ones in the first link you gave are very nice and useful.

您提供的第一个链接中的那些非常好且有用。

As far as the scroll is concerned, there is not much to do if you are not a Picassoin my opinion. I say go with the first link.

就卷轴而言,在我看来,如果你不是毕加索,就没什么可做的。我说去第一个链接。

回答by Brett VanderVeen

I like to use Tiny Scrollbarfor the minimalist design, and for the more custom use cases I use jQuery custom content scroller

我喜欢将Tiny Scrollbar用于极简设计,对于更多自定义用例,我使用jQuery 自定义内容滚动条

回答by mattie

I recommend this jQuery custom scrollbar plugin:

我推荐这个 jQuery 自定义滚动条插件:

https://github.com/mzubala/jquery-custom-scrollbar

https://github.com/mzubala/jquery-custom-scrollbar

Features include:

功能包括:

  • Vertical and horizontal scrollbars you can style your own way
  • Scrolling by mouse dragging, mouse wheel, keyboard – just as you would with native browser -scrollbar
  • Touch scrolling on mobile devices (Android, iPhone and iPad)
  • A couple of predefined skins showing you how to style scrollbars
  • Simple API that lets you scroll programmatically and be notified about scroll events
  • 您可以按照自己的方式设置垂直和水平滚动条
  • 通过鼠标拖动、鼠标滚轮、键盘滚动——就像使用原生浏览器一样 -scrollbar
  • 在移动设备(Android、iPhone 和 iPad)上触摸滚动
  • 几个预定义的皮肤向您展示如何设置滚动条的样式
  • 简单的 API,可让您以编程方式滚动并收到有关滚动事件的通知