All Projects → sebaferreras → Ionic3-FullscreenContent

sebaferreras / Ionic3-FullscreenContent

Licence: other
Ionic 3 demo of how to hide the header when scrolling down and show it again when scrolling up.

Programming Languages

typescript
32286 projects
HTML
75241 projects
CSS
56736 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Ionic3-FullscreenContent

Ionic3 Components
A project full of ionic 3 components and samples - to make life easier :)
Stars: ✭ 1,689 (+6937.5%)
Mutual labels:  angular2, ionic2
Awesome Ionic2 Components
Should help you to get awesome components and plugins for Ionic2
Stars: ✭ 209 (+770.83%)
Mutual labels:  angular2, ionic2
Ionic2 Pokedex
🎮 Pokédex sample app developed with Ionic 2, Angular 2 and Apache Cordova. Using Pokéapi as source for data.
Stars: ✭ 143 (+495.83%)
Mutual labels:  angular2, ionic2
Drip Ionic3
「水滴打卡」App Open Source Code Base On Ionic V3 Framework
Stars: ✭ 74 (+208.33%)
Mutual labels:  angular2, ionic2
ionic-video-chat-support
Ionic 3 Video and Group Text Chat
Stars: ✭ 19 (-20.83%)
Mutual labels:  angular2, ionic2
Ion Digit Keyboard V2
A digital keyboard plugin to use in Ionic 2 applications.
Stars: ✭ 97 (+304.17%)
Mutual labels:  angular2, ionic2
Growth Ionic
[v2.0 DEPRECATED, please update to Growth 3.0] Growth - App to help you Be Awesome Developer & Awesome Hacker
Stars: ✭ 2,200 (+9066.67%)
Mutual labels:  angular2, ionic2
Ionic Audio
An audio player for Ionic 3 and Angular 4. Works with HTML 5 audio or native audio using Cordova Media plugin.
Stars: ✭ 332 (+1283.33%)
Mutual labels:  angular2, ionic2
Dianoia-app
Mobile (Ionic 3 - Angular 4) app about non-pharmaceutical activities and information for people with dementia.
Stars: ✭ 13 (-45.83%)
Mutual labels:  angular2, ionic2
ionic2 firebase shopping cart
Shopping cart built using Ionic2 and Firebase
Stars: ✭ 21 (-12.5%)
Mutual labels:  angular2, ionic2
Ionic2 Environment Variables
Demonstration on how to easily setup environment variables in Ionic 2
Stars: ✭ 20 (-16.67%)
Mutual labels:  angular2, ionic2
ionic-uuchat
基于ionic3,angular4的实时聊天app,兼容web端。该项目只是前端部分,所有数据需要请求后端服务器,需要配套express-uuchat-api使用。
Stars: ✭ 14 (-41.67%)
Mutual labels:  angular2, ionic2
Bartonic
Quick Bart Schedule, Favorite Routes, Bart Map Ionic App
Stars: ✭ 8 (-66.67%)
Mutual labels:  angular2, ionic2
Ionic2 Reddit Reader
Ionic 2 Sample App
Stars: ✭ 128 (+433.33%)
Mutual labels:  angular2, ionic2
Ion2 Calendar
📅 A date picker components for ionic2 /ionic3 / ionic4
Stars: ✭ 537 (+2137.5%)
Mutual labels:  angular2, ionic2
Ionic2 Rating
⭐️ Angular star rating bar. Built for Ionic 2+.
Stars: ✭ 177 (+637.5%)
Mutual labels:  angular2, ionic2
angular-progress-bar
This component allow you to easy incorporate progress-bar to angular/ionic project, providing binding and color options
Stars: ✭ 26 (+8.33%)
Mutual labels:  angular2, ionic2
ionic-modal-custom-transitions
Add Custom Transitions to Ionic Modals.
Stars: ✭ 22 (-8.33%)
Mutual labels:  angular2, ionic2
Ngx Facebook
Angular TypeScript Wrapper for Facebook SDK
Stars: ✭ 214 (+791.67%)
Mutual labels:  angular2, ionic2
ionic2-geofence
Ionic2 Geofencing Sample Project
Stars: ✭ 96 (+300%)
Mutual labels:  angular2, ionic2

Fullscreen Content demo Open Source Love

Ionic 3 demo of how to hide the header when scrolling down and show it again when scrolling up.

ios android

Table of contents

Ionic info

Ionic:

   ionic (Ionic CLI)  : 4.0.1 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.11

Cordova:

   cordova (Cordova CLI) : 7.1.0
   Cordova Platforms     : android 6.3.0, ios 4.5.4

System:

   Android SDK Tools : 26.1.1
   ios-deploy        : 1.9.2
   ios-sim           : 5.1.0
   NodeJS            : v8.11.1 (/usr/local/bin/node)
   npm               : 5.10.0
   OS                : macOS High Sierra
   Xcode             : Xcode 9.4.1 Build version 9F2000

Running the demo

Inside of the project folder, run npm install and then to run the demo in the browser ionic serve [-t android/ios]

Using the component in your projects

Just copy the full-screen-content folder (inculding the html, ts and scss files) in your project, and include the FullscreenContentComponent in the declarations array from your @NgModule.

Then in your view, just include the header and the content inside the <fullscreen-content></fullscreen-content> tags and add the #target template variable to the header

<fullscreen-content>

    <ion-header #target>
        ...
    </ion-header>

    <ion-content>
        ...
    </ion-content>

</fullscreen-content>

Important

When using the component on iOS, please make sure to:

  1. Install the Web View plugin for Cordova that is specialized for Ionic apps.
  2. Configure the StatusBar cordova plugin setting the overlaysWebView to be false, and the backgroundColorByHexString to be the same color of your header. For example if your header's color is #387ef5 (Ionic's default primary color):
// Ionic Native
import { StatusBar } from '@ionic-native/status-bar';

// Pages
import { HomePage } from '../pages/home/home';

@Component({
    templateUrl: 'app.html'
})
export class MyApp {

    // ...

    constructor(platform: Platform, statusBar: StatusBar) {

        platform.ready().then(() => {

            statusBar.styleLightContent();

            if (platform.is('ios')) {
                statusBar.overlaysWebView(false);                // <--- Here!
                statusBar.backgroundColorByHexString('#387ef5'); // <--- And here!
            }

            // ...
        });
    }
}

Settings

The component also defines the FullScreenContentSettings interface, to customize the behaviour of the component.

export interface FullScreenContentSettings {
    tolerance?: number;
    offset?: number;
    headerVisibleClassName?: string;
    headerHiddenClassName?: string;
}

The settings should be sent to the component using the settings property:

// Fullscreen content settings
import { FullScreenContentSettings } from '../path/to/component/models/full-screen-content-settings';

@Component({
    selector: 'page-home',
    templateUrl: 'home.html'
})
export class HomePage {

    public customSettings: FullScreenContentSettings = {
        tolerance: 10,
        offset: 250
    };

    // ...
}

And in the view:

<fullscreen-content [settings]="customSettings">
    ...
</fullscreen-content>

You can change the default tolerance () and offset () and the class names used when showing (headerVisibleClassName) and hidding (headerHiddenClassName) the header.

Param Type Description Default value
tolerance number Optional. Scroll tolerance in px before state changes 10
offset number Optional. Vertical offset in px before element is first unpinned 250
headerVisibleClassName string  Optional. Name of the class used to show the header  header--visible
headerHiddenClassName string  Optional. Name of the class used to hide the header  header--hidden

Changelog

  • 04/08/2018 Updated dependencies to use the latest Ionic 3 version. Improved internal logic to avoid accessing the DOM directly

Contribution

  • Having an issue or looking for support? Open an issue and I'll do my best to help you out.
  • Got a new feature or a bug fix? Fork the repo, make your changes, and submit a pull request.

Support this project

If you find this project useful, please star the repo to let people know that it's reliable. Also, share it with friends and colleagues that might find this useful as well. Thank you! :)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].