I am currently working on creating a menu that displays arrows underneath the items when hovered over or when the .active
class is added to the menu. Everything is working fine, except for the fact that it only works on menus with drop-downs and the child items of the parent also display the arrows, which is not intended. Please visit my test site if you need to inspect it further.
Here is an example of what I want:
This is what I do not want:
As you can see above, the arrow is missing, which is odd because it appears for the 'Services' item but I don't want it to appear on its children. So, two fixes are needed.
CSS Code:
The CSS code uses absolute positioning and sets the opacity to 0 by default, making the item visible only on hover or click events.
[CSS CODE HERE]
JavaScript Code:
The JavaScript code is supposed to calculate the width of each menu item so that the arrow matches the width accordingly.
[JAVASCRIPT CODE HERE]
HTML:
Below is the HTML structure without the JavaScript functionality enabled, as enabling it fills in wrong values for widths on menus other than 'Services'.
[HTML CODE HERE]