Anchors not working on sub-menu

Anchors not working on sub-menu
0.0 0

#1

Hello anyone, just since today I’m experiencing some Issues with sub-menu anchors. They apparently seems not to open properly…but they are shown in the bottom-left part of the browser…does anyone know why? I’m struggling to this from an hour but still couldn’t find any solution…
http://lamoresca.it/alpha/home.html


#2

Hey there! I was curious and am procrastinating from sleep so I had a quick look!

If I’m not mistaken, the following line in js/menu-toggle.js appears to be the culprit:

$(".site-nav li:nth-child(2)").toggle(function() {

It seems to be selecting all li descendants that are a second child; in fact, if you inspect the behaviour of clicking any of the child li elements under the I Nostri Vini li element, you will find that all they are doing is the toggling of the menu for smaller screens as specified in the script.

This seems to fix the problem:

$(".main-menu > li:nth-child(2) > a").toggle(function() {

Applying an id to the I Nostri Vini li element and selecting it directly also seems to work:

<li id="i-nostri-vini">...</li>

$("#i-nostri-vini").toggle(function() {

I’m not entirely sure why the anchor element has to be selected in the first fix, though. Someone with more experience will hopefully comment on that!

I hope that helps! :slight_smile: