How to remove the scrollbar in an ionic page


#1

Hello,

I’m developing a login page and i want to remove the scrollbar, any idea on how to make that happend?
I tried to adda class to ion-content : <ion-content class="bg-image scroll">

and I applied this css code :

 .scroll {
        overflow: hidden;
    }

But it doesn’t work.
Any idea please? Thank you.


#2

Try:

@ViewChild(Content) content: Content;

...

this.platform.ready().then(() => {
  this.setDisableScroll(true);
}

private setDisableScroll(disable: boolean) : void {
  let scroll = this.content.getScrollElement();
  scroll.style.overflowY = disable ? 'hidden' : 'scroll';
}

#3

Hey Rob. I so appreciate your answer. I does work.

I put setDisableScroll(true) like below

ionViewDidLoad() {
        this.setDisableScroll(true);
  }

I tried so many different css hacks tp prevent scroll and none really worked well for me.

Thanks again!