简体   繁体   English

如何始终在移动浏览器中显示垂直滚动条

[英]How to show vertical scroll bar in mobile browser always

我想一直显示移动浏览器的垂直滚动条,不仅要增加页面高度,我还尝试过此html {overflow-y: scroll;}它在台式机上可以正常使用,但在移动设备上不行,任何建议... !

If you make something width a fixed height or width container such as a div, and then put another div inside it that is allowed to overflow it with height or width auto and overflow hidden, you can get drag behavior automatically if you set overflow: auto, or even overflow-x: auto or overflow-y: auto on the fixed height / width element. 如果您将固定宽度或高度的容器(例如div)设置为width,然后将另一个div放入其中,允许其以height或width auto溢出并隐藏其溢出,则在设置了overflow时可以自动获得拖动行为:auto ,甚至是overflow-x:自动或overflow-y:在固定的height / width元素上自动显示。

However, users will not always be able to tell that the area is draggable by visual cues like scrollbars appearing like they do in desktop browsers. 但是,用户将无法始终通过视觉提示(例如,在桌面浏览器中出现的滚动条)来判断该区域是否可拖动。

You can use a custom scroller such as https://github.com/inuyaksa/jquery.nicescroll and style a bar of your choice. 您可以使用自定义滚动条,例如https://github.com/inuyaksa/jquery.nicescroll并设置所选样式的栏。 Mobile example here: https://thoughtand.co/tings/ (This has a chunky looking bar but it can be really whatever you want) 此处的移动示例: https : //thoughtand.co/tings/ (它的外观看上去很笨拙,但实际上可以是您想要的任何东西)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM