html - 弹出窗口 : Toolbar within ion-header doesn’t stay fixed

标签 html css ionic4

我有一个带有标题和关闭按钮的弹出窗口,它应该固定在弹出窗口的顶部。为此,我将 ion-toolbar 放置在 ion-header 标签中,这应该使其固定在其位置(如有关工具栏的文档所述)。但是当内容需要滚动时,工具栏会像内容一样滚动出 View 。

我的弹窗模板:

<ion-header >
    <ion-toolbar position="top">
        <ion-button (click)="close()" slot="start" icon-only fill="clear">
            <ion-icon name="arrow-round-back"></ion-icon>
        </ion-button>
        <ion-title>{{TACName}}</ion-title>
    </ion-toolbar>
</ion-header>
<ion-content >
    <ion-card  *ngIf="cardTitle" >
        <ion-card-title  class="card-title">{{cardTitle}}</ion-card-title>
    </ion-card>
    <ion-card *ngIf="cardDesc" >
        <ion-card-title  class="card-desc">{{cardDesc}}</ion-card-title>
    </ion-card>
</ion-content>

有什么想法可以让工具栏固定在弹出窗口的顶部吗? 谢谢!

最佳答案

这是根据您的需要工作的。 ion-toolbar 中的按钮不随 ion-content 滚动。

<ion-header>
    <ion-toolbar position="top">
        <ion-buttons end>
            <button ion-button color="save">
                SAVE DRAFT
            </button>
        </ion-buttons>
        <ion-icon name="settings" style="float: left" routerLink="/settings"></ion-icon>
        <ion-title>
            Home
        </ion-title>
    </ion-toolbar>
</ion-header>
<ion-content>
    <h3>All Category</h3>
    <li>
        <!-- {{category.categoryTitle}} -->
    </li>

    <ion-row>
        <ion-col size="4" *ngFor="let category of category_array">
            <ion-card>
                <ion-card-header>
                    <ion-card-subtitle>Card Subtitle</ion-card-subtitle>
                    <ion-card-title>Card Title</ion-card-title>
                </ion-card-header>

                <ion-card-content>
                    Keep close to Nature's heart... and break clear away, once in awhile,
                    and climb a mountain or spend a week in the woods. Wash your spirit clean.
                </ion-card-content>
            </ion-card>
        </ion-col>
    </ion-row>
</ion-content>

On Top After some scroll

关于html - 弹出窗口 : Toolbar within ion-header doesn’t stay fixed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57935352/

相关文章:

javascript - 淡入淡出过渡而不淡入空白页

angular - 具有 i 到 j 值的 ionic 选择

javascript - 只为一些 div 设置一次动画

angular - Ion-slides 不更新动态数据

javascript - Ionic4 显示带换行符的文本

javascript - 如何通过 Chrome 扩展程序编辑页面?

html - 960.gs 框架 + 带有奇数成员的页脚

android - WebView 未加载网页

jquery - 文本出现在链接的右侧

jquery - 停止用作背景的书面文本推送内容