drop down menu works

This commit is contained in:
lenovo
2022-11-11 09:09:27 +01:00
parent cb0dcdddad
commit 55120b7504
2 changed files with 184 additions and 52 deletions

View File

@@ -39,28 +39,62 @@ function fill_filters(filters_div) {
let content = "";
let keys = Object.keys(filters);
keys.forEach((key) => {
//content += `
// <div class="filter_menu">
// <input id="filter_menu_title_${key}" class="filter_menu_title" type="checkbox">
// <label for="filter_menu_title_${key}" class="filter_menu_title"><p>${key}</p></label>
// <div class="filter_menu_drop">
//`;
content += `
<div class="filter_menu">
<div class="filter_menu_title" tabindex=0>
<p>${key}</p>
</div>
<div class="filter_menu_drop" tabindex=0>
`;
for (value of filters[key]) {
// // version input checkbox
//
// content += `
// <div class="filter_menu">
// <input id="filter_menu_title_${key}" class="filter_menu_title" type="checkbox" />
// <label for="filter_menu_title_${key}" class="filter_menu_title">
// <p>${key}</p>
// </label>
// <div class="filter_menu_drop">
// `;
// for (value of filters[key]) {
// content += `
// <p>${value._name}</p>
// `;
// }
// content += `
// </div>
// </div>
// `;
// // version select
//
// content += `
// <div class="filter_menu">
// <select id="filter_menu_drop_${key}" class="filter_menu_drop" name="${key}">
// `;
// for (value of filters[key]) {
// content += `
// <option value="${value._name}"><p>${value._name}</p></option>
// `;
// }
// content += `
// </select>
// </div>
// `;
// // version div
//
content += `
<p>${value._name}</p>
<div class="filter_menu">
<div class="filter_menu_title" tabindex=0>
<p>${key}</p>
</div>
<div class="filter_menu_drop" tabindex=0>
`;
}
content += `
for (value of filters[key]) {
content += `
<p>${value._name}</p>
`;
}
content += `
</div>
</div>
</div>
`;
`;
});
filters_div.innerHTML = content;

View File

@@ -14,7 +14,6 @@
#ljdp_map_filters {
position: relative;
border: 1px solid red;
width: 100%;
z-index: 1;
}
@@ -22,9 +21,37 @@
#ljdp_map_filters .filter_menu {
flex-direction: column;
width: 100%;
border: 1px solid blue;
border: 1px solid #ba197a;
}
/* **************************************
WIP VERSION SELECT
*/
/*
#ljdp_map_filters .filter_menu select.filter_menu_drop {
appearance: none;
text-align: center;
background-color: transparent;
border: none;
}
#ljdp_map_filters .filter_menu .filter_menu_drop option {
appearance: none;
text-align: center;
background-color: transparent;
border: none;
}
*/
/* **************************************
VERSION INPUT CHECKBOX
*/
/*
#ljdp_map_filters .filter_menu input.filter_menu_title {
display: none;
@@ -32,57 +59,128 @@
#ljdp_map_filters .filter_menu label.filter_menu_title {
width: 100%;
border: 1px solid green;
}
*/
#ljdp_map_filters .filter_menu .filter_menu_title {
width: 100%;
cursor: pointer;
border: 1px solid green;
}
#ljdp_map_filters .filter_menu .filter_menu_drop {
/*
display: none;
*/
flex-direction: column;
position: absolute;
top: 0%;
top: 100%;
left: 0px;
margin: 0px;
padding: 10px 0px;
width: 100%;
max-height: 400px;
background-color: #ffffff;
overflow-y: scroll;
cursor: pointer;
}
#ljdp_map_filters .filter_menu input.filter_menu_title:checked
~ .filter_menu_drop {
display: flex;
}
#ljdp_map_filters .filter_menu .filter_menu_drop p {
padding: 0px 10px;
width: 100%;
}
#ljdp_map_filters .filter_menu .filter_menu_drop p:hover {
background-color: #dddddd;
}
*/
/* **************************************
VERSION DIV STICK
*/
/*
#ljdp_map_filters .filter_menu .filter_menu_title {
width: 100%;
cursor: pointer;
}
#ljdp_map_filters .filter_menu .filter_menu_drop {
display: none;
flex-direction: column;
position: absolute;
top: 100%;
left: 0px;
margin: 0px;
padding: 10px 0px;
width: 100%;
max-height: 400px;
background-color: #ffffff;
overflow-y: scroll;
cursor: pointer;
}
#ljdp_map_filters .filter_menu:focus-within .filter_menu_drop {
display: flex;
}
#ljdp_map_filters .filter_menu .filter_menu_drop p {
padding: 0px 10px;
width: 100%;
}
#ljdp_map_filters .filter_menu .filter_menu_drop p:hover {
background-color: #dddddd;
}
*/
/* **************************************
VERSION DIV SWITCH
*/
/*
*/
#ljdp_map_filters .filter_menu .filter_menu_title {
width: 100%;
cursor: pointer;
}
#ljdp_map_filters .filter_menu .filter_menu_drop {
flex-direction: column;
position: absolute;
left: 0px;
margin: 0px;
width: 100%;
max-height: 400px;
cursor: pointer;
border: 1px solid pink;
/* padding-top must be sufficient to hide the menu */
padding: 100px 0px 0px 0px;
height: 0px;
background-color: transparent;
overflow: hidden;
border: none;
/*
overflow: visible;
*/
}
/*
#ljdp_map_filters .filter_menu input.filter_menu_title:checked
~ .filter_menu_drop {
display: flex;
background-color: transparent;
height: 100%;
top: 0%;
overflow: hidden;
}
*/
#ljdp_map_filters .filter_menu .filter_menu_drop:focus {
top: 100%;
background-color: #ffffff;
overflow: scroll;
height: auto;
padding: 10px 0px;
top: 100%;
overflow: scroll;
border: 1px solid #ba197a;
}
#ljdp_map_filters .filter_menu .filter_menu_drop p:first-child {
margin-top: 100px;
}
#ljdp_map_filters .filter_menu .filter_menu_drop:focus p:first-child {
margin-top: auto;
}
#ljdp_map_filters .filter_menu .filter_menu_drop p {
margin: 0px auto 0px 0px;
padding: 0px 10px;
width: 100%;
}