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

时间:2016-08-30 07:28:08

标签: angular typescript ionic-framework ionic2

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

我如何在离子2中实施?

enter image description here

1 个答案:

答案 0 :(得分:26)

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

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

with 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):

    overlayHidden: boolean = false;

and (after constructor):

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