Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
(function () { | |||
window. | if (window.raceInfoLoaded) return; | ||
window.raceInfoLoaded = true; | |||
document. | function showRaceInfo(race) { | ||
var infoBox = document.querySelector('.race-info'); | |||
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 () { | |||
var race = card.getAttribute("data-race"); | |||
showRaceInfo(race); | |||
}); | |||
}); | }); | ||
}); | }); | ||
} | })(); | ||
Версия от 21:10, 15 февраля 2025
(function () {
if (window.raceInfoLoaded) return;
window.raceInfoLoaded = true;
function showRaceInfo(race) {
var infoBox = document.querySelector('.race-info');
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 () {
var race = card.getAttribute("data-race");
showRaceInfo(race);
});
});
});
})();