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
25 changes: 24 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,30 @@
<link rel="stylesheet" href="styles.css">
</head>
<body>
<!--Верстать тут-->
<div class="logo logo5">
<img src="designs/logo5.png" alt="Flag of Japan">
</div>
<div class="logo logo6">
<img src="designs/logo6.png" alt="Microsoft">
</div>
<button id="button">Открыть модальное окно</button>
<div id='modal' class="modal">
<div class="modal-content">
<span class="close">&times;</span>
<p>Привет! 💕</p>
</div>
</div>
<div class="modal-content">
<span class="close">&times;</span>
<div class="progress-container">
<div class="progress-bg">
<span class="progress-text text-black">Loading...</span>
<div class="progress-fill" style="width: 45%;">
<span class="progress-text text-white">Loading...</span>
</div>
</div>
</div>
</div>
<script src="index.js"></script>
</body>
</html>
36 changes: 35 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,38 @@
const element = document.querySelector('.myElement');
element.style.color = 'red';
element.style.width = '300px';
*/
*/

const modal = document.getElementById("modal");
const btn = document.getElementById("button");
const span = document.getElementsByClassName("close")[0];
btn.onclick = function() {
modal.style.display = "flex";
}

span.onclick = function() {
modal.style.display = "none";
}

window.onclick = function(event) {
if (event.target === modal) {
modal.style.display = "none";
}
}

const progressFill = document.querySelector('.progress-fill');
const duration = 3000;
const frameRate = 15;
const totalFrames = duration / frameRate;

let currentFrame = 0;
const timer = setInterval(() => {
currentFrame++;
let progressPercent = (currentFrame / totalFrames) * 100;
if (progressPercent <= 100) {
progressFill.style.width = progressPercent + "%";
} else {
clearInterval(timer);
}

}, frameRate);
100 changes: 100 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
.logo{
width: 100px;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}


.logo.logo6 img{
width: auto;
height: 130%;
transform: scale(2);
}

.modal {
display: none;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 10;
justify-content: center;
align-items: center;
}

.modal-content{
background-color: wheat;
width: 640px;
padding: 20px;
position: relative;
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
font: bold 14px "Roboto", sans-serif;
}

.close {
position: absolute;
top: 10px;
right: 15px;
color: grey;
font-size: 28px;
font-weight: bold;
cursor: pointer;
line-height: 1;
}

.close:hover,
.close:focus {
color: black;
text-decoration: none;
cursor: pointer;
}

.progress-container {
margin: 20px 0;
width: 100%;
}

.progress-bg {
position: relative;
width: 100%;
height: 40px;
background-color: grey;
border-radius: 5px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}

.progress-fill {
position: absolute;
left: 0;
top: 0;
height: 100%;
background-color: rgba(255, 0, 0, 0.5);
overflow: hidden;
display: flex;
align-items: center;
}

.progress-text {
position: absolute;
width: 640px;
text-align: center;
text-transform: uppercase;
}

.text-black {
color: black;
z-index: 1;
}

.text-white {
color: white;
z-index: 2;
}