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
52 changes: 49 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,53 @@
<link rel="stylesheet" href="styles.css">
</head>
<body>
<!--Верстать тут-->
<script src="index.js"></script>
<div class="logo-container">
<div class="logo logo1"></div>
<div class="logo logo2"></div>
</div>

<button id="open-modal-button">Открыть модальное окно</button>

<div id="modal" class="modal">
<div class="modal-content">
<span class="close-button">&times;</span>
<h2>Заголовок модального окна</h2>

<div class="progress-bar">
<div class="progress"></div>
<div class="progress-text">Loading...</div>
</div>

<div class="accordion">
<div class="accordion-item">
<input type="checkbox" id="accordion-1">
<label for="accordion-1">Раздел 1</label>
<div class="accordion-content">
ОГО ЭТО 1 РАЗДЕЛ
</div>
</div>

<div class="accordion-item">
<input type="checkbox" id="accordion-2">
<label for="accordion-2">Раздел 2</label>
<div class="accordion-content">
ОГО ЭТО 2 РАЗДЕЛ
</div>
</div>

<div class="accordion-item">
<input type="checkbox" id="accordion-3">
<label for="accordion-3">Раздел 3</label>
<div class="accordion-content">
Такого не бывает, это 3 раздел!
</div>
</div>
</div>
</div>
</div>

<div id="overlay" class="overlay"></div>

<script src="index.js"></script>
</body>
</html>
</html>
60 changes: 54 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,55 @@
/*
Изменить элементу цвет и ширину можно вот так:
const openModalButton = document.getElementById('open-modal-button');
const modal = document.getElementById('modal');
const overlay = document.getElementById('overlay');
const closeButton = document.querySelector('.close-button');
const progressBar = document.querySelector('.progress');
const progressText = document.querySelector('.progress-text');

const element = document.querySelector('.myElement');
element.style.color = 'red';
element.style.width = '300px';
*/
openModalButton.addEventListener('click', () => {
modal.classList.add('active');
overlay.classList.add('active');
animateProgressBar();
});

closeButton.addEventListener('click', () => {
modal.classList.remove('active');
overlay.classList.remove('active');
resetProgressBar();
});

overlay.addEventListener('click', () => {
modal.classList.remove('active');
overlay.classList.remove('active');
resetProgressBar();
});

modal.addEventListener('click', (event) => {
event.stopPropagation();
});


function animateProgressBar() {
let width = 0;
const intervalTime = 3000;
const frameRate = 30;
const increment = 100 / (intervalTime * frameRate / 1000);
const interval = setInterval(frame, 1000 / frameRate);

function frame() {
if (width >= 100) {
clearInterval(interval);
progressText.textContent = "Complete!";
progressText.style.color = 'white';
} else {
width += increment;
progressText.style.color = 'black';
progressBar.style.width = width + '%';
}
}
}

function resetProgressBar() {
progressBar.style.width = '0%';
progressText.textContent = "Loading...";
progressText.style.color = 'black';
}
127 changes: 127 additions & 0 deletions styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
.logo-container {
display: flex;
gap: 20px;
}

.logo {
width: 100px;
height: 100px;
overflow: hidden;
background-size: contain;
background-repeat: no-repeat;
}

.logo1 {
background-image: url('designs/logo1.png');
}

.logo2 {
background-image: url('designs/logo2.png');
}

.modal {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 640px;
background-color: white;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
z-index: 2;
border-radius: 5px;
padding: 20px;
display: none;
}

.modal-content {
position: relative;
}

.close-button {
position: absolute;
top: 0;
right: 0;
font-size: 20px;
cursor: pointer;
color: #888;
padding: 5px;
}

.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 1;
display: none;
}

.modal.active, .overlay.active {
display: block;
}

.progress-bar {
width: 100%;
height: 30px;
background-color: #eee;
border-radius: 5px;
overflow: hidden;
position: relative;
}

.progress {
width: 0%;
height: 100%;
background-color: red;
transition: width 0.1s linear;
}

.progress-text {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: black;
font-weight: bold;
z-index: 1;
}


.accordion {
margin-top: 20px;
}

.accordion-item {
margin-bottom: 10px;
border: 1px solid #ccc;
border-radius: 5px;
overflow: hidden;
}

.accordion-item label {
display: block;
padding: 10px;
background-color: #f0f0f0;
cursor: pointer;
font-weight: bold;
}

.accordion-content {
padding: 10px;
background-color: #fff;
display: none;
}

.accordion-item input[type="checkbox"] {
display: none;
}

.accordion-item input[type="checkbox"]:checked + label {
background-color: #ddd;
}

.accordion-item input[type="checkbox"]:checked + label + .accordion-content {
display: block;
}