!! put a dropdown button with
list of
link in a menu
!! wims_read_parm is :
!! line 1 name of the button
!! line 2 id of the button
!! each other line is an item of the dropdown button with format word1
link ; word2 linkname
!if $js_numberdropdownbutton_=$empty
!let js_numberdropdownbutton_=0
<style>
a, .dropbtn {
display: inline-block;
color: black;
text-align: center;
text-decoration: none;
}
a:hover, .dropdown:hover .dropbtn {
background-color: #f9f9f9;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.show {display:block;}
</style>
<script>
/* When the user clicks on the button, toggle between hiding and showing the dropdown content */
function myFunction(test) {
var dropdowns = document.getElementsByClassName("dropdown-content");
for (var d = 0; d < dropdowns.length; d++) {
var openDropdown = dropdowns[d];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
document.getElementById(test).classList.toggle("show");
}
// Close the dropdown if the user clicks outside of it
window.onclick = function(e) {
if (!e.target.matches('.dropbtn')) {
var dropdowns = document.getElementsByClassName("dropdown-content");
for (var d = 0; d < dropdowns.length; d++) {
var openDropdown = dropdowns[d];
if (openDropdown.classList.contains('show')) {
openDropdown.classList.remove('show');
}
}
}
}
</script>
!endif
!increase js_numberdropdownbutton_
!let keyid_=!line 1 of $wims_read_parm
!let keyname_=!line 2 of $wims_read_parm
!let nb_=!linecnt $wims_read_parm
<button class="dropdown">
<a href="javascript:void(0)" class="dropbtn" onclick='myFunction("$keyid_")'>$keyname_</a>
<div class="dropdown-content" id="$keyid_">
!for k_=3 to $nb_
!let l_=!line $k_ of $wims_read_parm
!let link_=!word 1 of $l_
!let name_=!word 2 to -1 of $l_
!href $link_ $name_
</div>
</button>