1

I'm trying to set up the scroll position of ion-content a little bit down to hide some elements at the beginning of this control.

I need something like this

I have tried 'start-y="xx"' attribute but it doesn't work.

Any suggestions?

<ion-content start-y="55">
Daniel
  • 10,641
  • 12
  • 47
  • 85
Jhon Tobar
  • 13
  • 3

1 Answers1

2

In ionic4 there currently isn't an attribute for scroll starting position. However, there is a scroll method you can use on page initialisation which you can use like so:

.ts

    import { Component, ViewChild } from '@angular/core';
    import {IonContent} from '@ionic/angular';
    @Component({
      selector: 'app-home',
      templateUrl: 'home.page.html',
      styleUrls: ['home.page.scss'],
    })
    export class HomePage {
         @ViewChild(IonContent) theContent: IonContent;


    ngOnInit() {this.theContent.scrollToPoint(0,150).then(()=>{}) }
    }
}

comment if you need anything clarifying

Ira Watt
  • 2,095
  • 2
  • 15
  • 24
  • 1
    I just replace 'IonContent' for 'Content' and the method this.theContent.scrollTo(0,150).then(()=>{}) and it works for me! Thank you sr. – Jhon Tobar May 17 '19 at 14:44