March 24, 2024 at 11:40 pm
#1438209
Hi,
Thank you for you answer,
I don’t know why but my class have changed. It works now with “.av-hamburger-inner”
It works like before if I use that : “.av-hamburger-inner”, but not with your edited code : “.av-hamburger-inner.isactive”
Nothing happens when I add the .isactive, and the previous code dont works too.
Do you know where it could come from ?
<!DOCTYPE html>
<html lang="fr">
<meta charset="UTF-8">
<title>Page avec gestion du menu</title>
<script>
window.addEventListener('pageshow', function(event) {
// Vérifier si l’événement de pageshow est une traversée de l’historique
if (event.persisted) {
// Masquer le menu
var menuButton = document.querySelector('.av-hamburger-inner.isactive');
if (menuButton) {
menuButton.click(); // Simuler un clic sur le bouton de menu pour le masquer
}
}
});
</script>
<body>
<!-- Contenu de votre page ici -->
<!-- Bouton du menu (à remplacer par le sélecteur réel de votre bouton de menu) -->
<button class="av-hamburger-inner">Menu</button>
</body>
</html>
But when I click on the page when I inspect the page, I have this class :
av-hamburger av-hamburger--spin av-js-hamburger av-inserted-main-menu is-active
When i past this in the code I have only a menu button which appears, so I dont know what is the issue.
Thank you