forked from indymedia/epicyon
Dropdown disappears when click away
parent
da7e8b43e8
commit
b70532d4da
|
@ -562,10 +562,6 @@ input[type=submit]:hover {
|
|||
padding: 5% 0px;
|
||||
}
|
||||
|
||||
.dropbtn {
|
||||
opacity: 1.0;
|
||||
}
|
||||
|
||||
/* The container <div> - needed to position the dropdown content */
|
||||
.dropdown {
|
||||
margin: 10px auto;
|
||||
|
|
|
@ -991,6 +991,18 @@ def clickToDropDownScript() -> str:
|
|||
script= \
|
||||
'function dropdown() {' \
|
||||
' document.getElementById("myDropdown").classList.toggle("show");' \
|
||||
'}' \
|
||||
'window.onclick = function(event) {' \
|
||||
" if (!event.target.matches('.dropdown')) {" \
|
||||
' 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');" \
|
||||
' }' \
|
||||
' }' \
|
||||
' }' \
|
||||
'}'
|
||||
return script
|
||||
|
||||
|
|
Loading…
Reference in New Issue