Dantes (обсуждение | вклад) Нет описания правки |
Dantes (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
function toggleTimeline(period) { | function toggleTimeline(period) { | ||
var content = document.getElementById('content-' + period); | var content = document.getElementById('content-' + period); | ||
if (content.style.display === "none") { | if (content) { | ||
if (content.style.display === "none") { | |||
content.style.display = "block"; | |||
} else { | |||
content.style.display = "none"; | |||
} | |||
} | } | ||
} | } | ||
| Строка 11: | Строка 13: | ||
$(".timeline-header").click(function() { | $(".timeline-header").click(function() { | ||
var period = $(this).attr("id").replace("header-", ""); | var period = $(this).attr("id").replace("header-", ""); | ||
toggleTimeline(period); | if (period) { | ||
toggleTimeline(period); | |||
} | |||
}); | }); | ||
}); | }); | ||
Версия от 07:13, 17 января 2025
function toggleTimeline(period) {
var content = document.getElementById('content-' + period);
if (content) {
if (content.style.display === "none") {
content.style.display = "block";
} else {
content.style.display = "none";
}
}
}
$(document).ready(function() {
$(".timeline-header").click(function() {
var period = $(this).attr("id").replace("header-", "");
if (period) {
toggleTimeline(period);
}
});
});