<button id="play" data-source="https://www.youtube.com/embed/dQw4w9WgXcQ">Play</button>
<div id="modal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<iframe id="youtube-video" width="560" height="315" frameborder="0" allowfullscreen></iframe>
</div>
</div>
<style>
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
}
.modal.show {
display: flex;
justify-content: center;
align-items: center;
}
.modal-content {
position: relative;
background-color: #fefefe;
padding: 20px;
border-radius: 8px;
max-width: 800px;
width: 90%;
}
.close {
position: absolute;
top: 10px;
right: 20px;
font-size: 28px;
font-weight: bold;
color: #aaa;
cursor: pointer;
}
.close:hover {
color: #000;
}
iframe {
width: 100%;
aspect-ratio: 16/9;
}
</style>
<script>
const playButton = document.getElementById('play');
const modal = document.getElementById('modal');
const closeButton = document.querySelector('.close');
const iframe = document.getElementById('youtube-video');
playButton.addEventListener('click', () => {
const videoUrl = playButton.getAttribute('data-source');
iframe.src = videoUrl + '?autoplay=1';
modal.classList.add('show');
});
closeButton.addEventListener('click', () => {
modal.classList.remove('show');
iframe.src = '';
});
// Закрытие модального окна при клике вне его
window.addEventListener('click', (event) => {
if (event.target === modal) {
modal.classList.remove('show');
iframe.src = '';
}
});
</script>
@media (min-width: 768px) /* ширина по вашему хотению */ {
.block {
display: grid;
grid-template-columns: repeat(3, 1fr);
}
.yellow {
grid-column: span 3;
}
}
.text {
font-size: 12px;
@include media-breakpoint-up(md) {
font-size: 20px;
}
}
.text {
font-size: 12px;
}
@media (min-width: 767px) {
font-size: 20px;
}
.text {
font-size: clamp(12px, 3vw, 30px);
}
<div class="my-grid">
<div class="my-cell"></div>
<div class="my-cell"></div>
<div class="my-cell"></div>
<div class="my-cell"></div>
<div class="my-cell"></div>
</div>
.my-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 30px;
height: 100vh;
}
.my-cell:first-child {
grid-row: span 2;
}
.react-select {
// какие-то свойства
&__option {
//...
}
}
<div class="ratio ratio-16x9">
<iframe src="https://www.youtube.com/embed/zpOULjyy-n8?rel=0" title="YouTube video" allowfullscreen></iframe>
</div>