The popup content isn’t showing on click.
I will only put the shortened version of the code.
When the button is clicked, the content should be showed.
The html button will trigger the js code to set the css to active.
The css will show the active version of the popup that makes it visible.
function togglePopup() {
document.getElementById("popup_chicken").classList.toggle("active");
}
.chicken {
background: rgb(0, 0, 0, 0.5);
width: 100%;
height: auto;
text-align: center;
z-index: 2;
transform: translate(-50%, -50%) scale(0);
visibility: hidden;
&_content {
display: inline-block;
background-color: black;
border-radius: 30px;
box-shadow: -5px 5px 10px black;
padding: 20px;
width: 80%;
margin-top: 3%;
margin-bottom: 3%;
&_buttons {
margin: 15px 0;
&_close {
background-color: $b;
cursor: pointer;
border-radius: 50px;
border-style: hidden;
padding: 20px 30px;
margin: 0 25px;
}
.chicken.active .chicken {
transform: translate(-50%, -50%) scale(1);
transition: all 300ms ease-in-out;
visibility: visible;
}
}
<button onclick="togglePopup()">
click me!
</button>
<div class="chicken" id="popup_chicken">
<div class="chicken_content">
content here
<button class="chicken_buttons_close" onclick="togglePopup()">Close</button>
</div>
</div>
2
Answers
I am not sure if this is what you want, but you can give this a try;
Your nested css should be as follow. For more info pls follow this link for more details
.