feat: added dinamic videos at why-program

This commit is contained in:
Aliaksei Karzhou
2024-07-16 23:45:31 +03:00
parent 2f3396d8b3
commit 708b115a09
5 changed files with 24 additions and 15 deletions

View File

@@ -3,7 +3,10 @@ const whyProgramVideoContent = document.querySelector('.why-program__video-conte
reviewsSlideVideos.forEach((videoEl) => {
videoEl.addEventListener('click', (event) => {
if (whyProgramVideoContent) whyProgramVideoContent.classList.remove('active');
if (whyProgramVideoContent) {
whyProgramVideoContent.classList.remove('active');
whyProgramVideoContent.innerHTML = '';
}
reviewsSlideVideos.forEach((video) => {
if (video === event.currentTarget) {
video.classList.add('active');
@@ -30,6 +33,20 @@ reviewsSlideVideos.forEach((videoEl) => {
if (whyProgramVideoContent) {
whyProgramVideoContent.addEventListener('click', (event) => {
event.currentTarget.classList.add('active');
reviewsSlideVideos.forEach((video) => video.classList.remove('active'));
event.currentTarget.innerHTML = `
<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/XIMLoLxmTDw?si=wFzm5etjCkaNdMl5"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
referrerpolicy="strict-origin-when-cross-origin"
allowfullscreen
></iframe>
`;
reviewsSlideVideos.forEach((video) => {
video.classList.remove('active');
});
});
}