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
49 changes: 48 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,54 @@
<link rel="stylesheet" href="styles.css">
</head>
<body>
<!--Верстать тут-->
<div class="logo"><img src="designs/logo5.png"/></div>
<div class="logo"><img src="designs/logo6.png"/></div>
<script src="index.js"></script>
<div class="lightbox">
<div class="lightbox-content">
<h1>HELLO</h1>
<button class="exit" onClick="hide()">✖</button>
<div class="progress-bar">
<div class="progress"></div>
</div>
<div>
<label>section 1</label>
<input type="checkbox">
<p>
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</p>
</div>
<div>
<label>section 2</label>
<input type="checkbox">
<p>
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
</p>
</div>
<div>
<label>section 3</label>
<input type="checkbox">
<p>
ccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccc
ccccccccccccccccccccccccccccccccc
</p>
</div>
</div>
</div>
<div class="blur"></div>
</body>
</html>
33 changes: 27 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
/*
Изменить элементу цвет и ширину можно вот так:

const element = document.querySelector('.myElement');
element.style.color = 'red';
element.style.width = '300px';
*/
document.addEventListener('DOMContentLoaded', () => {
const progressBar = document.querySelector('.progress');
fillProgressBar(3000, progressBar);
});

function hide() {
document.querySelector('.lightbox').style.display = 'none';
document.querySelector('.blur').style.display = 'none';
}

function fillProgressBar(duration, progressBar) {
let startTime = null;

function animate(timestamp) {
if (!startTime) {
startTime = timestamp;
}
const progress = timestamp - startTime;
const percentage = Math.min(progress / duration * 100, 100);
progressBar.style.width = percentage + '%';

if (progress < duration) {
requestAnimationFrame(animate);
}
}
requestAnimationFrame(animate);
}
87 changes: 87 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
img {
width: 100px;
}

.logo {
border: 1px solid black;
overflow: hidden;
width: 100px;
height: 100px;
margin: 10px;
}

.lightbox {
display: flex;
position: fixed;
justify-content: center;
align-items: center;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 10;
}

.lightbox-content {
position: relative;
width: 640px;
max-height: 80%;
overflow: auto;
margin: 10% auto;
background: aliceblue;
padding: 10px;
}

.blur {
position: fixed;
top: 0;
left: 0;
z-index: 9;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.4);
backdrop-filter: blur(5px);
}

.exit {
position: absolute;
top: 10px;
right: 10px;
}

.progress-bar {
background-color: gray;
width: 100%;
height: 40px;
position: relative;
}

.progress-bar::before, .progress::before {
content: "Loading...";
font-size: 24px;
color: white;
position: absolute;
left: 320px;
top: 20px;
transform: translate(-50%, -50%);
}

.progress-bar::before {
color: black;
}

.progress {
position: absolute;
font-size: 24px;
background-color: red;
height: 100%;
overflow: hidden;
}

input[type='checkbox'] + p {
display: none;
}

input[type='checkbox']:checked + p {
display: block;
}