I managed to hide and show a div using this Javascript code:
<script>
function myFunction() {
var x = document.getElementById("menudesplegable");
if (x.style.display === "none") {
x.style.display = "block";
} else {
x.style.display = "none";
}
}
</script>
The issue I face is that when the element is not visible, it does not take any space, but when visible, it moves all the other content down. It is a menu toggle, so I need all the other content to be in the same position and this div to display on top. Is it possible? Thanks so much!!!
2
Answers
What I understood from your question is. You want the meu content to overlay not push the down content. For that thing, you have to make changes in your design. make the content relative and give it z index 1. Here is CSS snippet for you.
and here is the div content for more understanding.
and last your function! its okay no need to change.
You could also use a CSS animation as follows:
{
}