Happy new year to all!! I'm a JS beginner and I'm playing with a circular menu on a web page. This is the circular menu:
https://codepen.io/bennettfeely/pen/qRJOZJ/
I have implemented this menu with 11 rings. The 'Menu' and 'Close' buttons work. When I click on a menu item it goes to the item but the menu stays open. I would need to close the menu when the item is clicked or anywhere else on the page is clicked. I have the feeling that the solution is all in the JS script.But it seems to me that the JS is complete and I don´t understand why it does not work. The:
setTimeout(function(){
nav.classList.toggle('open');
}, 800);
should do it, am I right? Or is anything missing? I have also added a
<script src="https://code.jquery.com/jquery-3.3.1.js"
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous"></script>
to my html as I noticed that the code is actually jquery and not JS, but it didn´t help.
This is how I'm keeping the menu items links in the markup:
<a href="#scuola" class="disc l7">
<div>scuola</div>
</a>
<a href="#attivita" class="disc l8">
<div>attività</div>
</a>
<a href="#chi" class="disc l9">
<div>chi siamo</div>
</a>
<a href="index.html" class="disc l10">
<div>home</div>
</a>
<a class="disc l11 toggle">
Menu
</a>
</nav><!--menu end-->