mirror of https://gitlab.com/bashrc2/epicyon
Minimize javascript use
parent
2f1bba5b8e
commit
4921332f77
|
@ -992,24 +992,8 @@ def clickToDropDownScript() -> str:
|
||||||
"""Function run onclick to create a dropdown
|
"""Function run onclick to create a dropdown
|
||||||
"""
|
"""
|
||||||
script= \
|
script= \
|
||||||
'/* When the user clicks on the button,' \
|
|
||||||
'toggle between hiding and showing the dropdown content */' \
|
|
||||||
'function dropdown() {' \
|
'function dropdown() {' \
|
||||||
' document.getElementById("myDropdown").classList.toggle("show");' \
|
' document.getElementById("myDropdown").classList.toggle("show");' \
|
||||||
'}' \
|
|
||||||
'' \
|
|
||||||
'// Close the dropdown menu if the user clicks outside of it' \
|
|
||||||
'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
|
return script
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue