Reputation: 15
currently I have an HTML file that have some content that I present in modalview upon click of a button. I wish to check if it is possible to display element in the HTML outside of the modal view.
I tried using css to style the element, but I am unable to move the element out of the modal-wrapper.
Please assist to advice.
I am not able to embed image into the post yet, so i provided a link.
Upvotes: 1
Views: 2637
Reputation: 2736
By referring to the making modals 50% of size and round icon css. I have build a sample below with your requirements. You can find the working version here
Hope it helps and let me know if you have any issues.
Modal.html
<ion-content padding class="main-view">
<div class="overlay" (click)="dismiss()"></div>
<div class="modal_content">
<div class="circle"></div>
<div class="modal-content">
<h2>Welcome to Ionic!</h2>
<p>
This starter project comes with simple tabs-based layout for apps
that are going to primarily use a Tabbed UI.
</p>
<p>
Take a look at the <code>pages/</code> directory to add or change tabs,
update any existing page or create new pages.
</p>
</div>
</div>
</ion-content>
Modal.scss
modal-wrapper {
position: absolute;
width: 100%;
height: 100%;
}
@media not all and (min-height: 600px) and (min-width: 768px) {
ion-modal ion-backdrop {
visibility: hidden;
}
}
@media only screen and (min-height: 0px) and (min-width: 0px) {
.modal-wrapper {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
.main-view{
background: transparent;
}
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
opacity: .5;
background-color: #333;
}
.modal_content {
display: block;
position: relative;
top: calc(50% - (50%/2));
left: 0;
right: 0;
width: 100%;
height: 50%;
padding: 10px;
z-index: 1;
margin: 0 auto;
padding: 10px;
color: #333;
background: #e8e8e8;
background: -moz-linear-gradient(top, #fff 0%, #e8e8e8 100%);
background: -webkit-linear-gradient(top, #fff 0%, #e8e8e8 100%);
background: linear-gradient(to bottom, #fff 0%, #e8e8e8 100%);
border-radius: 5px;
box-shadow: 0 2px 3px rgba(51, 51, 51, .35);
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
//overflow: hidden;
}
.circle{
position:absolute;
height:100px;
width:100px;
border-radius:50%;
border:3px solid white;
left:50%;
margin-left:-55px;
top: -40px;
background: #d33;
z-index: 10000;
}
.modal-content{
padding-top: 5rem;
}
Upvotes: 4