Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea

# Logs
logs
*.log
Expand Down
27 changes: 27 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,33 @@
</head>
<body>
<!--Верстать тут-->
<div class="wrapper">
<div class="circle" id="circle1"></div>
<div class="circle" id="circle2"></div>
<div class="circle" id="circle3"></div>
</div>

<div class="wrapper">
<div class="circle" id="circle4"></div>
</div>

<button id="openBtn">Открыть Lightbox</button>

<div id="lightbox" class="lightbox">
<div class="lightbox-content">
<span class="close-btn" id="closeBtn">&times;</span>
<p>КОНТЕНТИЩЕ</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. A ab animi consequatur dicta eaque eos eum expedita
explicabo illum ipsa ipsam ipsum magni necessitatibus neque, obcaecati, quas sapiente veniam vero!</p>
<div class="progress-container" id="progressContainer">
<span class="text"> Loading...</span>
<div class="progress-bar" id="progressBar">
<span class="text-not-normal"> Loading...</span>
</div>
</div>
</div>
</div>

<script src="index.js"></script>
</body>
</html>
39 changes: 38 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,41 @@
const element = document.querySelector('.myElement');
element.style.color = 'red';
element.style.width = '300px';
*/
*/


const lightbox = document.getElementById('lightbox');
const openBtn = document.getElementById('openBtn');
const closeBtn = document.getElementById('closeBtn');

openBtn.addEventListener('click', () => {
lightbox.classList.add('active');
});

closeBtn.addEventListener('click', () => {
lightbox.classList.remove('active');
});

lightbox.addEventListener('click', (e) => {
if (e.target === lightbox) {
lightbox.classList.remove('active');
}
});

openBtn.addEventListener('click', () => {
const progressBar = document.querySelector('#progressBar');

let progress = 0;
const duration = 3000;
const interval = 20;
const step = 100 / (duration / interval);

const timer = setInterval(() => {
progress += step;
if (progress >= 100) {
progress = 100;
clearInterval(timer);
}
progressBar.style.width = progress + "%";
}, interval);
});
107 changes: 107 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
.wrapper{
position: relative;
width: 100px;
height: 100px;
border: 1px solid black;
margin: 5px;
}

.circle {
width: 40px;
height: 40px;
border-radius: 50%;
background: black;
position: absolute;
}


#circle1{
left: 0;
top: 0;
z-index: -1;
}

#circle2{
right: 0;
top: 0;
z-index: -2;
}

#circle3{
width: 70px;
height: 70px;
top: 20%;
left: 15%;
}

#circle4{
background: red;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}

.lightbox {
display: none; /* Скрыто по умолчанию */
position: fixed;
top: 0; left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
justify-content: center;
align-items: center;
z-index: 1000;
}

.lightbox.active {
display: flex;
}

.lightbox-content {
width: 640px;
height: auto;
background: white;
padding: 20px;
position: relative;
border-radius: 5px;
}


.close-btn {
position: absolute;
top: 10px; right: 15px;
cursor: pointer;
font-size: 24px;
}

.progress-container{
position: relative;
overflow: hidden;
text-align: center;
width : 100%;
height : 20px;
border: 1px solid black;
background: gray;
}

.progress-bar{
position: absolute;
top : 0;
text-align: center;
width : 0;
height : 100%;
background: red;
overflow: hidden;
}

.text{
position: absolute;
color: black;
}

.text-not-normal{
color: white;
position: absolute;
z-index: 2;
}