問題描述
我只想在需要滾動(dòng)的頁面中隱藏滾動(dòng)條.我正在使用離子 2
I just want to hide the scrollbar, in a page that needs scrolling. I am using Ionic 2
我的不起作用解決方案:
.scroll-content-bar{
overflow: hidden;
}
此解決方案隱藏滾動(dòng)條但使屏幕無法滾動(dòng).
This solution hide the scroll-bar but makes the screen unscrollable.
推薦答案
首先,改變?yōu)g覽器的自然行為和預(yù)期的用戶體驗(yàn)是一個(gè)冒險(xiǎn)的舉動(dòng).
First and foremost, changing natural behavior of the browser and expected user experience is a risky move.
但是,如果您仍然真的很想這樣做,我認(rèn)為您最好的選擇是偽造它.在這種情況下,將 width
設(shè)置為 0 就足夠了,但我還將背景顏色更改為完全透明.
However, if you still really really want to, I think your best bet is to fake it. In this case, setting width
to 0 should be enough but I'm also changing background colors to be completely transparent.
div{
background: gray;
height: 200px;
overflow-y: scroll;
}
p{
border-bottom: 1px solid black;
}
div::-webkit-scrollbar {
border:none;
width:0;
background: rgba(0,0,0,0);
}
div::-webkit-scrollbar-track {
border:none;
width:0;
background: rgba(0,0,0,0);
}
div::-webkit-scrollbar-thumb {
border:none;
width:0;
background: rgba(0,0,0,0);
}
<div>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
<p>content</p>
</div>
這篇關(guān)于Ionic 2:隱藏滾動(dòng)條并繼續(xù)滾動(dòng)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!