У меня есть раскрывающееся меню, настроенное точно так же, как и другие раскрывающиеся меню. Однако в этом раскрывающемся меню под ним отображаются параметры, и я не могу выбрать элемент.
Кроме того, когда я добавляю в него параметры с помощью JavaScript, только эти параметры отображаются правильно и доступны для выбора.
HTML-код:
//Create new option
const option = document.createElement('option');
option.textContent = item;
// Add option to the list
document.getElementById('itemRemover').appendChild(option);
У меня есть раскрывающееся меню, настроенное точно так же, как и другие раскрывающиеся меню. Однако в этом раскрывающемся меню под ним отображаются параметры, и я не могу выбрать элемент. Кроме того, когда я добавляю в него параметры с помощью JavaScript, только эти параметры отображаются правильно и доступны для выбора. HTML-код: [code] Select item to be removed:
Remove
[/code] Код JavaScript, используемый для добавления параметров в раскрывающийся список: [code]//Create new option const option = document.createElement('option'); option.textContent = item; // Add option to the list document.getElementById('itemRemover').appendChild(option); [/code] CSS-код: [code]/* Resetting default styles */ body, html { margin: 0; padding: 0; font-family: Arial, sans-serif; }
.container { text-align: center; }
/* Heading on Top of Image */ .image-with-heading { position: relative; width: 100%; max-width: 600px; /* Adjust the width of the image */ margin: 20px auto; /* Center alignment */ }
/* Input fields stacked underneath each other, with labels, on top of the image */ .image-with-inputs .input-group { position: absolute; top: 50%; /* Adjust vertical alignment */ left: 50%; /* Center horizontally */ transform: translate(-50%, -50%); /* Center both horizontally and vertically */ display: flex; flex-direction: column; /* Stack inputs vertically */ gap: 10px; /* Space between inputs and their labels */ overflow: visible; }
/*Vertical wrapper*/ .input-group .vertical-container{ position: absolute; top: 50%; /* Adjust vertical alignment */ left: 50%; /* Center horizontally */ transform: translate(-50%, -50%); /* Center both horizontally and vertically */ display: flex; flex-direction: column; align-items: center; gap: 10px; overflow: visible; }
/* Wrapper for each input field */ .input-group .input-wrapper { display: flex; flex-direction: column; align-items: center; /* Center text and inputs */ gap: 2px; /* Space between label and input */ overflow: visible; }
.square { width: 200px; /* Size of the square */ height: 200px; /* Size of the square */ background-color: white; border-radius: 10px; display: flex; }
/* Dropdown fields stacked underneath each other, with labels, on top of the image */ .image-with-inputs .dropdown-group { position: absolute; top: 50%; /* Adjust vertical alignment */ left: 50%; /* Center horizontally */ transform: translate(-50%, -50%); /* Center both horizontally and vertically */ display: flex; flex-direction: column; /* Stack dropdowns vertically */ gap: 10px; /* Space between dropdowns and their labels */ overflow: visible; }
/* Wrapper for each dropdown */ .dropdown-group .dropdown-wrapper { display: flex; flex-direction: column; align-items: center; /* Center text and dropdown */ gap: 5px; /* Space between label and dropdown */ overflow: visible !important; }
< /code> Изображение задачи: Введите описание изображения здесь < /p> Я попытался использовать переполнение: visible < /code> на родителе и я Попробовал сделать другие элементы на странице меньше, так как я думал, что страница слишком заполнялась, была проблемой. -code "> // This itemsList has items var itemsList = ['apple', 'banana', 'cherry', 'berry'] if (itemsList.length !== 0) { document.getElementById('itemRemover').style.display = 'block';
itemsList.forEach(item => { //Create new option const option = document.createElement('option'); option.textContent = item; // Add option to the list document.getElementById('itemRemover').appendChild(option); }); }< /code> /* Dropdown fields stacked underneath each other, with labels, on top of the image */ .image-with-inputs .dropdown-group { position: absolute; top: 50%; /* Adjust vertical alignment */ left: 50%; /* Center horizontally */ transform: translate(-50%, -50%); /* Center both horizontally and vertically */ display: flex; flex-direction: column; /* Stack dropdowns vertically */ gap: 10px; /* Space between dropdowns and their labels */ overflow: visible; }
/* Wrapper for each dropdown */ .dropdown-group .dropdown-wrapper { display: flex; flex-direction: column; align-items: center; /* Center text and dropdown */ gap: 5px; /* Space between label and dropdown */ overflow: visible !important; }