Pizzicato
Pizzicato

Reputation: 1621

Ionic: Scrollable areas with fixed areas layout

I'm having some trouble in an app I'm developing in which the client wants to have some fixed areas which contains tabs and filters, and one infinite scroll main area which contains the corresponding data which is selected on the tabs and filtered:

enter image description here

I've tried different options to accomplish this layout, and got some issues in each case:

Also, maybe is possible to include the yellow area in the ion-header, but I find this very inflexible, and hard to structure. In this case, the tabs headers would be in ion-header, while the content in ion-content, which seems pretty weird from my point of view.

Any ideas in how to achieve this?

Upvotes: 3

Views: 1279

Answers (1)

Vijay Kumawat
Vijay Kumawat

Reputation: 963

put the fixed content into the header itself wrapping in a ion row

<ion-header>
    <ion-toolbar>
        <ion-buttons slot="start">
            <ion-menu-button></ion-menu-button>
        </ion-buttons>
        <ion-title>Header Title</ion-title>
    </ion-toolbar>
    <ion-row class="filter-row">
        <ion-col>
            <span>All</span>
        </ion-col>
        <ion-col>
            <span>High</span>
        </ion-col>
        <ion-col>
            <span>Medium</span>
        </ion-col>
        <ion-col>
            <span>Low</span>
        </ion-col>
        <ion-col>
            <span>No Priority</span>
        </ion-col>
    </ion-row>
</ion-header>

If you don't want to put the tabs into header, here is the second solution you can use

wrap the fixed tabs and other stuff you want to be fixed at the top below header into a div and add position sticky to the div with these css properties

    position: sticky;
    top: 0;
    z-index: 1;

Upvotes: 4

Related Questions