5.0.0 • Published 11 months ago

ionic-header-parallax v5.0.0

Weekly downloads
43
License
ISC
Repository
github
Last release
11 months ago

Parallax Header Directive for Ionic v4

This directive enables parallax effect on ion-header elements to display a cover photo while on top of the page and transition it to the normal navbar when content is scrolled down.

For Ionic 3 use version 1.1.0 of this package: $ npm i ionic-header-parallax@1.1.0.

alt text

Set Up

  1. Install package: $ npm i ionic-header-parallax.
  2. Import the directive into your desired module (usually appmodule.ts):
import { IonicHeaderParallaxModule } from 'ionic-header-parallax';

@NgModule({
  imports: [
    IonicHeaderParallaxModule,
    ...

Usage

Just add the attribute parallax to any <ion-header> element:

<ion-header parallax></ion-header>

Optional attributes:

  • imageUrl (string): The background image to show while expanded.
  • maximumHeight (number): The height for the header when expanded. Default is 200.
  • expandedColor (string): The color (web hex formatted) to show while the header is expanded when no imageUrl is set. When scrolled it will fade to the navbar/toolbar's color or the one configured in <toolbar color=""> attribute.
  • titleColor (string): The text color (web hex formatted) for <ion-title> and <ion-back-button> elements when expanded. They will turn to their default color on cover collapse.

Example:

<ion-header parallax imageUrl="https://picsum.photos/350" maximumHeight="350" expandedColor="#AAA" titleColor="white">

  <ion-toolbar color="primary">
    <ion-title>
      Parallax Header
    </ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
	Some content here
</ion-content>

Modifying the Source Code / Contributing

I don't plan to be maintaining this package full-time, but as I'm usually developing in Ionic I'll be glad to update it any time I make some upgrades for myself. Contributions are very welcome. Find the instructions in the CONTRIBUTING.md file.

Feel free to improve the code!

Credits

Raschid JF. Rafaelly

me@raschidjfr.dev

https://raschidjfr.dev

This is an adaptation of this awesome tutorial on v2 by Josh Morony. Thanks.

5.0.0

11 months ago

4.0.0

11 months ago

3.0.2

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0-rc

2 years ago

3.0.0

3 years ago

0.0.1

3 years ago

3.0.0-dev

3 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

1.1.0

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.1

5 years ago

1.0.0

6 years ago