Shows a submenu when the mouse is hovered over the button
<p>I'm looking for a solution where when I hover over a button a submenu pops up. Currently the menu is only shown when clicked. Does anyone know what I need to change so that when hovering over a button the menu shows up and when clicked the menu stays there. </p>
<p>Solution: Change hover to mouseover. </p>
<p><strong>Does anyone know how to make all sections (sect1...) not show on mouseover? </strong></p>
<pre class="brush:php;toolbar:false;"><script>
var divs
var btn1 = document.getElementById("btn1");
var btn2 = document.getElementById("btn2");
var btn3 = document.getElementById("btn3");
btn1.mouseover = function(event){
event.preventDefault();
toggleDivs("sect1");
};
btn2.mouseover = function(event){
event.preventDefault();
toggleDivs("sect2");
};
btn3.mouseover = function(event){
event.preventDefault();
toggleDivs("sect3");
};
function toggleDivs(s){
//reset
document.getElementById("sect1").classList.remove("shown");
document.getElementById("sect2").classList.remove("shown");
document.getElementById("sect3").classList.remove("shown");
//show
document.getElementById(s).classList.add("shown");
}
//force button1 state initialise, if required
//btn1.focus();
//btn1.click();
</script>
<style>
.elementor-editor-active .hidden{
display:block;
}
.hidden{
display:none;
}
.show{
display: block !important;
}
</style></pre></p>