I just started playing around Polymer dialog. I try to create a custom element polymer dialog and use it in a paper card. However, I faced problem because the dialog appears based on the size/position of the paper card instead of the full page.
May I know how do I style it so that the dialog size/position will be based on the main page instead of the card? Thank you.
Main page, paper-card is a 100x100px card:
<paper-card>
Text
<my-custom-dialog></my-custom-dialog>
</paper-card>
My-custom-dialog:
<dom-module id="my-custom-dialog">
<style is="custom-style">
paper-dialog {
position: absolute;
top: 3%;
left: 0px;
margin-top: 0px;
width: 100%;
height: 100%;
overflow: auto;
z-index: 1;
}
.fa-times {
cursor: pointer
}
</style>
<template>
<i class="fa fa-object-group" aria-hidden="true" on-tap="toggleDialog"></i>
<paper-dialog id="dialog" always-ontop entry-animation="scale-up-animation" exit-animation="fade-out-animation">
<div class="buttons">
<i class="fa fa-times" aria-hidden="true" dialog-confirm></i>
</div>
<strong>Text here</strong>
</paper-dialog>
</template>
</dom-module>
<script>
Polymer({
is: "my-custom-dialog",
toggleDialog: function () {
this.$.dialog.toggle();
},
})
</script>
BartKoppelmans is correct. The paper-dialog needs to be outside the paper-card. You can still keep the button inside the card.
<template>
<paper-card style="width: 50%;">
<i class="fa fa-object-group" aria-hidden="true" on-tap="toggleDialog">?</i>
</paper-card>
<paper-dialog id="dialog" always-ontop auto-fit-on-attach entry-animation="scale-up-animation" exit-animation="fade-out-animation">
<div class="buttons">
<i class="fa fa-times" aria-hidden="true" dialog-confirm></i>
</div>
<strong>Text here</strong>
</paper-dialog>
</template>