[英]Disable Scrollbar in Cordova iOS
i want to disable the Scrollbar in my iOS App.我想在我的 iOS 应用程序中禁用滚动条。 The Content should be scrollable, but the scrollbar should be invisible.内容应该是可滚动的,但滚动条应该是不可见的。
How can i realize this?我怎么能意识到这一点?
The other answer is great and perfect (as far as I know) for most browsers.对于大多数浏览器,另一个答案是伟大而完美的(据我所知)。 However, if you were just targeting iOS and/or Android, this CSS would be simpler, sufficient, and requires no structural changes to your HTML:但是,如果您只针对 iOS 和/或 Android,则此 CSS 会更简单、足够,并且不需要对 HTML 进行结构更改:
::-webkit-scrollbar {
display: none;
}
I just tested this myself.我只是自己测试了这个。 Works with webkit browsers, which means it'll work for Android/iOS.适用于 webkit 浏览器,这意味着它适用于 Android/iOS。
You can try this first overflow-y: hidden;
你可以先试试这个overflow-y: hidden;
will hide both the scroll bar and then overflow-y: scroll;
将隐藏滚动条然后overflow-y: scroll;
will allow to scroll vertically.将允许垂直滚动。
CSS CSS
#content {
position: relative;
width: 200px;
height: 150px;
border: 1px solid black;
overflow: hidden;
}
#scrollable {
height: 150px;
width: 218px;
overflow-y: scroll;
}
HTML: HTML:
<div id="content">
<div id="scrollable">
<!--Content goes here-->
</div>
</div>
Hope this helps.!希望这可以帮助。!
None of the above answers worked for me as of 2020 so here's what fixed it for me:截至 2020 年,上述答案均不适用于我,因此以下是为我解决的问题:
Apply申请
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
Where you would like to hide the scrollbar您想隐藏滚动条的位置
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.