ion-header-scroll-opacity
Version:
Change header background opacity on content scroll
60 lines (59 loc) • 1.57 kB
TypeScript
import { Renderer2, OnInit, OnDestroy } from '@angular/core';
import { IonContent, IonToolbar } from '@ionic/angular';
/**
* @description
*
* Change the header/toolbar opacity when the ion-content is scrolling
*
* ## Usage
*
* ```html
* <ion-header scrollOpacity [ionContentRef]="mycontent">
* <ion-toolbar color="primary">
* <ion-title>Scroll</ion-title>
* </ion-toolbar>
* </ion-header>
*
* <ion-content #mycontent [scrollEvents]="true">
* </ion-content>
* ```
*/
export declare class IonHeaderScrollOpacityDirective implements OnInit, OnDestroy {
private renderer;
/**
* Reference to ion-content component
*/
ionContentRef: IonContent;
/**
* Amount of pixel to be scrolled in order end the opacity transition
*/
scrollAmount: number;
/**
* If true the header background starts with opacity=0
*/
isTransparent: boolean;
/**
* ion-toolbar reference
*/
toolbar: IonToolbar;
/**
* Toolbar background html element
*/
toolbarEl: HTMLElement;
/**
* Element where the scrolling takes place
*/
scrollArea: HTMLElement;
/**
* Scroll subscription ref. When the target component is destroyed we should unsubscribe to avoid memory leak
*/
private scrollSbuscription;
constructor(renderer: Renderer2);
ngOnInit(): Promise<void>;
ngOnDestroy(): void;
/**
* Extract the toolbar-background element from the toolbar shadow dom
*/
readonly toolbarBackgroundEl: Element;
changeOpacity(): void;
}