如何在离子2中创建叠加页面?

时间:2021-09-19 23:01:52

How to creating an transparent guide overlay page when i enter into new page

当我进入新页面时如何创建透明指南覆盖页面

How can i implement in ionic 2 ?

我怎样才能在离子2中实现?

如何在离子2中创建叠加页面?

1 个解决方案

#1


17  

You can just create div outside the <ion-content>:

你可以在 之外创建div:

<div class="my-overlay" padding [hidden]="overlayHidden">
    <button full (click)="hideOverlay()">Click me</button>
</div>

with CSS:

使用CSS:

.my-overlay {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 20;
  top: 0;
  left: 0;
}

In class declaration add (before constructor):

在类声明add(构造函数之前):

    overlayHidden: boolean = false;

and (after constructor):

和(在构造函数之后):

public hideOverlay() {
    this.overlayHidden = true;
}

#1


17  

You can just create div outside the <ion-content>:

你可以在 之外创建div:

<div class="my-overlay" padding [hidden]="overlayHidden">
    <button full (click)="hideOverlay()">Click me</button>
</div>

with CSS:

使用CSS:

.my-overlay {
  position: fixed;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  z-index: 20;
  top: 0;
  left: 0;
}

In class declaration add (before constructor):

在类声明add(构造函数之前):

    overlayHidden: boolean = false;

and (after constructor):

和(在构造函数之后):

public hideOverlay() {
    this.overlayHidden = true;
}