8.0.25 • Published 2 years ago

@tetkosimi/ionic-stretchheader v8.0.25

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Hide Navigation Bar for Ionic 5+

With this module you can:

  • implement an expansible header that stretches when pulling the page down

NPM version

🔥 ..Also works with Supertabs 🔥

npm.io

Check out the example

Installation

npm i @tetkosimi/ionic-stretchheader

Implementation

Create (or modify if you already have) a shared.module.ts in your project root folder:

import { NgModule } from '@angular/core';
import { StretchHeaderModule } from '@tetkosimi/ionic-stretchheader';

@NgModule({
    imports: [StretchHeaderModule],
    exports: [StretchHeaderModule]
})
export class SharedModule { }

and import the SharedModule on every page you intend to use this plugin:

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { Routes, RouterModule } from '@angular/router';

import { IonicModule } from '@ionic/angular';

import { HomePage } from './home.page';
import { SharedModule } from '../shared.module';

const routes: Routes = [
    {
        path: '',
        component: HomePage
    }
];

@NgModule({
    imports: [
        CommonModule,
        FormsModule,
        IonicModule,
        RouterModule.forChild(routes),
        SharedModule
    ],
    declarations: [HomePage]
})
export class HomePageModule {
}

Part 1: Expansible header

This is a custom component defined using this HTML tag:

<stretchheader></stretchheader>

This component must be defined outside of <ion-content> and comes with required and optional child DOM elements:

Creating the expansible header element

home.page.html

#shrinkexpand: This is the element that will shrink and expand with scrolling the page #static: Element(s) with this tag will be left alone. You can use these to create buttons on your header for example.

<stretchheader header-height="50">
    <div #shrinkexpand><!-- Expanding DOM element --></div>
    <div #static><!-- Title --></div>
    <div #static><!-- Nav button --></div>
</stretchheader>

Inputs for <stretchheader>:

inputtypeDescription
header-heightrequiredheight to which the header shrinks to
opacity-factoroptional / default = 01 - 10 opacity of shrunk header overlay
opacity-coloroptional / default = blackaccepts any css color description (name, rgb, # ..)
blur-factoroptional / default = 0the maximum blur when the header is collapsed (accepts integer)
init-expandedoptional / default = falseset to true if you want the header to initiate expanded
no-borderoptional / default = falseset to true if you want to remove the bottom styling of the header

Adding your Header to a simple page:

add the stretchheader-content directive to your <ion-content>

<stretchheader header-height="50">
    <div #shrinkexpand>...</div>
</stretchheader>
<ion-content stretchheader-content>
    ....
</ion-content>
8.0.25

2 years ago

8.0.24

2 years ago

8.0.23

2 years ago

8.0.22

2 years ago

8.0.21

2 years ago

8.0.20

2 years ago

8.0.19

2 years ago

8.0.18

2 years ago

8.0.17

2 years ago

8.0.16

2 years ago

8.0.15

2 years ago

8.0.14

2 years ago

8.0.13

2 years ago

8.0.12

2 years ago

8.0.11

2 years ago

8.0.10

2 years ago

8.0.9

2 years ago

8.0.8

2 years ago

8.0.7

2 years ago

8.0.6

2 years ago

8.0.5

2 years ago

8.0.4

2 years ago

8.0.3

2 years ago

8.0.2

2 years ago

8.0.1

2 years ago

8.0.0

2 years ago