While testing my website on a computer, whenever I click on an item in the menu bar on my website and go to that page, then go back to the previous page, for some reason the website freezes. If I refresh the frozen page, the website runs normally. I have no problems using the website on a mobile device.
I’ve tried looking to see if any of the CSS or Javascript in my website would be causing this issue, but I haven’t found anything.
Below is the Javascript that I’m currently using on my website. I have it set so that the content behind the mobile menu doesn’t move while open and so that it will close after an item in it has been clicked.
`document.getElementById('cp_toggle03').onchange = function() {
if (document.getElementById('cp_toggle03').checked) {
document.body.style.overflow = "hidden";
} else {
document.body.style.overflow = "";
}
}
var elements = document.getElementsByTagName('li');
var closeHamp = function() {
document.getElementsByClassName('cp_menuicon')[0].click();
};
for (var i = 0; i < elements.length; i++) {
elements[i].addEventListener('click', closeHamp, false);
}`
Could changing or removing this Javascript help sort out the issue? If anyone has any solutions, I’d appreciate it if you’d share them with me.