Achieve test
by Oleh Kotsubko
HTML
<button id="open-modal">Click me</button>
<div class="modal">
<button class="close" id="close-modal">
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAADoSURBVHgB7ZTNDYMwDIWfYYGOkBU6AptU6gKcKnWCHnphgUrdpKtkBBYA6lRFMlF+bM68CyS23xcRG+BQRSQX1/75ARY3Yerew93DoEv/cC1arsf4Gm7ndb+RSQub8+OXGAqglDB37HGSsQ1g5pMvgLdAInM/Y+5knFIFDRdwwPHSlz5XyjzOpVxhDaIxzwJqEK15EZCDhH2teRWQgvy3VeYqQAICrXlQA6Vo8646lw4QX6h1TqqXnBoi7ZwUAaVWtAwjWc1ljgZCe8wtENprroVsushqHhRy4r+wjMdtOlrMM5ARhyz6Ahxl/J12cQtWAAAAAElFTkSuQmCC" alt="">
</button>
<h1 class="modal__title">Открыта ачивка</h1>
<div class="achieve">
<div class="wrapper">
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span class="particles-circle"></span>
<span...
SCSS
.modal {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -60%);
background: #010E28;
border: 1px solid rgba(255, 255, 255, 0.24);
box-sizing: border-box;
border-radius: 4px;
color: #fff;
font-family: sans-serif;
padding: 64px 48px 38px;
opacity: 0;
visibility: hidden;
transition: all 0.3s ease-in-out;
width: 440px;
text-align: center;
&__title {
opacity: 0;
transform: translateY(20px);
transition: all 0.3s ease-in-out;
transition-delay: 0.2s;
font-weight: bold;
font-size: 24px;
line-height: 32px;
margin-bottom: 24px;
margin-top: 0;
&.second {
transition-delay: 0.6s;
}
}
&.is-shown {
transform: translate(-50%, -50%);
opacity: 1;
visibility: visible;
}
}
.close {
position: absolute;
top: 24px;
right: 24px;
border: none;
background-color: transparent;
cursor: pointer;
outline: none !important;
img {
pointer-events: none;
}
}
.achieve {
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
.wrapper {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
.circle {
position: relative;
width: 100px;
height: 100px;
border: 5px solid #3BBBE9;
border-radius: 50%;
overflow: hidden;
z-index: 1;
margin-bottom: 24px;
}
.particle {
position: absolute;
&.head {
bottom: 18px;
left: 12px;
z-index: 2;
}
&.body {
bottom: -4px;
left: 2px;
}
}
.tail {
position: absolute;
top: -13px;
left: -9px;
}
$theme: #3BBBE9;
$speed: 1.5s;
.particles-circle {
position: absolute;
background-color: $theme;
width: 30px;
height: 30px;
top: 10px;
left: 50%;
margin-left: -15px;
z-index: -1;
border-radius: 50%;
transform: scale(0);
visibility: hidden;
&:nth-of-type(odd) {
border: solid 2px $theme;
background-color: transparent;
}
}
.is-shown {
.modal__title {
...
JavaScript
document.getElementById('open-modal').addEventListener('click',() => {
document.querySelector('.modal').classList.toggle('is-shown')
} );
//close
document.getElementById('close-modal').addEventListener('click',() => {
document.querySelector('.modal').classList.remove('is-shown')
} )