Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
(не показаны 3 промежуточные версии этого же участника) | |||
Строка 1: | Строка 1: | ||
(function () { | |||
if (window.raceInfoLoaded) return; | |||
window.raceInfoLoaded = true; | |||
function showRaceInfo(race) { | |||
var infoBox = document.getElementById('race-info-box'); | |||
} | var description = document.getElementById(race); | ||
if (description) { | |||
infoBox.innerHTML = description.innerHTML; | |||
infoBox.style.display = 'block'; | |||
} | |||
} | } | ||
var | document.addEventListener("DOMContentLoaded", function () { | ||
var cards = document.querySelectorAll('.race-card'); | |||
cards.forEach(function (card) { | |||
card.addEventListener("click", function (event) { | |||
event.preventDefault(); | |||
showRaceInfo(card.getAttribute("data-race")); | |||
}); | |||
}); | }); | ||
} | }); | ||
}); | })(); |
Текущая версия от 21:18, 15 февраля 2025
(function () { if (window.raceInfoLoaded) return; window.raceInfoLoaded = true; function showRaceInfo(race) { var infoBox = document.getElementById('race-info-box'); var description = document.getElementById(race); if (description) { infoBox.innerHTML = description.innerHTML; infoBox.style.display = 'block'; } } document.addEventListener("DOMContentLoaded", function () { var cards = document.querySelectorAll('.race-card'); cards.forEach(function (card) { card.addEventListener("click", function (event) { event.preventDefault(); showRaceInfo(card.getAttribute("data-race")); }); }); }); })();