2020–2024, 2010–2019 и 2005–2009. У меня он «работает» индивидуально, но как только я включаю все три, отображается только последний. Что мне здесь не хватает? У меня очень мало опыта работы с CSS/js/html. Я могу хорошо следовать указаниям, но не знаю, что есть в языке, что должно быть очевидно для более опытного человека.
Вот соответствующие части страницы. Как я сказал выше, я могу заставить работать каждую из трех подкатегорий, но не все три одновременно.
Код: Выделить всё
/* When the user clicks on the button,
toggle between hiding and showing the dropdown content */
function doDropdown() {
/*document.getElementById("myDropdown").classList.toggle("show");*/
document.getElementById("dropDown2020").classList.toggle("show");
document.getElementById("dropDown2010").classList.toggle("show");
document.getElementById("dropDown2000").classList.toggle("show");
}
function showDecade2020() {
document.getElementById("myDropdown2020").classList.toggle("show");
}
function showDecade2010() {
document.getElementById("myDropdown2010").classList.toggle("show");
}
function showDecade2000() {
document.getElementById("myDropdown2000").classList.toggle("show");
}
// Close the dropdown menu if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
var i;
for (i = 0; i < dropdowns.length; i++) {
var openDropdown = dropdowns[i];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}Код: Выделить всё
/* Dropdown Button */
.dropbtn {
background-color: white;
color: black;
padding: 16px;
font-size: 16px;
border: none;
cursor: pointer;
box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.2);
}
/* Dropdown button on hover & focus */
.dropbtn:hover,
.dropbtn:focus {
background-color: white;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
/* The container - needed to position the dropdown content */
.dropdown {
position: relative;
display: inline-block;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-content {
display: none;
position: absolute;
background-color: #f1f1f1;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 1;
}
/* Links inside the dropdown */
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
}
/* Change color of dropdown links on hover */
.dropdown-content a:hover {
background-color: #ddd;
}
/* Show the dropdown menu (use JS to add this class to the .dropdown-content container when the user clicks on the dropdown button) */
.show {
display: block;
}Код: Выделить всё
Jump to a specific year...
2020-2024
[url=#2024]2024[/url]
[url=#2023]2023[/url]
[url=#2022]2022[/url]
[url=#2021]2021[/url]
[url=#2020]2020[/url]
2010-2019
[url=#2019]2019[/url]
[url=#2018]2018[/url]
[url=#2017]2017[/url]
[url=#2016]2016[/url]
[url=#2015]2015[/url]
[url=#2014]2014[/url]
[url=#2013]2013[/url]
[url=#2012]2012[/url]
[url=#2011]2011[/url]
[url=#2010]2010[/url]
2005-2009
[url=#2009]2009[/url]
[url=#2008]2008[/url]
[url=#2007]2007[/url]
[url=#2006]2006[/url]
[url=#2005]2005[/url]
Подробнее здесь: https://stackoverflow.com/questions/785 ... wn-buttons
Мобильная версия