I'm trying to build a mega menu with the code below.
This is the link from the menu to show the mega menu
<li><a href="javascript:void(0);" id="mmBtn"></li>
And this is the javascript
// Get the modal
var modal = document.getElementById('mmCat');
// Get the button that opens the modal
var btn = document.getElementById("mmBtn");
// Closes the modal
var span = document.getElementsByClassName("close")[0];
// Open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// Close the modal
span.onclick = function() {
modal.style.display = "none";
}
// Close it from outside
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
Is it possible to use a link like this instead to get the ID and not reload the page and not showing the hashtag in addressbar?
<a href="test.com/products#mmBtn">