Currently, I am working on a mobile menu that reveals a submenu when an item is clicked. The issue arises when the page is scrolled down; upon opening or closing the submenu, the page automatically scrolls back to the top.
This scrolling problem only occurs when the page has been scrolled
Below is the code snippet:
http://jsfiddle.net/qsq4y9d8/3/
Here is the CSS for the submenu items:
.lisottomenu {
letter-spacing: 0.02em;
display: block;
background: #E4BF85;
border-top: 1px solid #fff;
font-size: 14px;
list-style-type: none;
width:100%;
}
The CSS for the parent item looks like this:
ul li.leaf {
background: #646464 none repeat scroll 0 0;
border-top: 1px solid #a0a0a0;
display: block;
font-size: 15px;
letter-spacing: 0.02em;
list-style-type: none;
position: relative;
}
Illustrated below is the specific issue:
https://i.sstatic.net/jfpyH.png
(the automatic scrolling glitch)
I would greatly appreciate any assistance, as the code can be lengthy and English isn't my first language...