Minimize javascript use

master
Bob Mottram 2019-08-24 19:46:50 +01:00
parent 2f1bba5b8e
commit 4921332f77
1 changed files with 0 additions and 16 deletions

View File

@ -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