如何根据ionic4中的滚动show\Hide按钮

How to show\Hide button according to scrolling in ionic4

我想在我的离子项目中使用 scrollToTop。在我的代码 scrollToTop 工作但我想在 ionic 中滚动内容时显示按钮。如何在离子中显示粘性按钮请帮助我...... 在图像中,我的按钮显示在最后想要显示在中间并在我滚动时显示..

tab1.page.html

        <ion-content cache-view="false" (ionScrollStart)="logScrollStart()" (ionScroll)="logScrolling($event)"
          (ionScrollEnd)="logScrollEnd()" [scrollEvents]="true">
        <button class="scroll"  (click)="ScrollToTop()">
              <ion-icon name="arrow-dropup-circle"></ion-icon>
            </button>
            </ion-content>

tab1.page.ts

ScrollToTop(){
    this.content.scrollToTop(1500);
  }

对于 "when I'm scrolling",您可以使用以下内容检测您的心形图标是否在可滚动卡片中可见:

How to Check if element is visible after scrolling?