Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ionic 2: Hide scroll-bar and keep scrolling

I just want to hide the scrollbar, in a page that needs scrolling. I am using Ionic 2

My not working solution:

.scroll-content-bar{
     overflow: hidden;
}

This solution hide the scroll-bar but makes the screen unscrollable.

like image 639
Anthony gesquière Avatar asked Feb 09 '17 14:02

Anthony gesquière


People also ask

How do I turn off horizontal scrolling?

To hide the horizontal scrollbar and prevent horizontal scrolling, use overflow-x: hidden: HTML. CSS.

How do I stop vertical scrolling in CSS?

If you just want to prevent scrolling horizontally or vertically, then set the Body to overflow hidden in the designer.

How do I hide the scroll bar in Chrome?

2. Type "Remove Scrollbars" (without quotes) in the search box and press "Enter." Click the "Remove Scrollbars" option located on top of the search results.


1 Answers

First and foremost, changing natural behavior of the browser and expected user experience is a risky move.

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>
like image 59
Serg Chernata Avatar answered Sep 24 '22 22:09

Serg Chernata