Я хочу, чтобы индекс зависел от решение, которое пользователь выбирает на главной странице.
Код: Выделить всё
document.querySelectorAll('.discover-button').forEach(function(button, index) {
button.addEventListener('click', function(event) {
var solutionIndex = index;
var videoIframe = document.getElementById('videoIframe');
var videoUrl = solutions[solutionIndex].url;
videoIframe.src = videoUrl;
document.getElementById('iframeContainer').style.display = 'block';
});
});
function closeIframe() {
var videoIframe = document.getElementById('videoIframe');
videoIframe.src = '';
document.getElementById('iframeContainer').style.display = 'none';
}Код: Выделить всё
Discover
X
Подробнее здесь: https://stackoverflow.com/questions/784 ... javascript
Мобильная версия