Problem with Weglot button

Hi… it has been days on a really small problem and getting crazy… so I try to ask for help here…
I would like to hide the weglot button when the menu mobile is open.

I’m working on this page:

the interested elements are:
the sandwich menu: #menu-menu

weglot switch eng/ita: .weglot-container

what I want to achieve:
when #menu-menu has the class .w–open, .weglot-container gets a new class .hidelang

the code I used is the following, I tried many different things (adding css rules, like display:none), or other ones, but nothing, I haven’t kept all the attempt so this is what I have right now

read-only:
https://preview.webflow.com/preview/one-ocean-foundation?utm_medium=preview_link&utm_source=designer&utm_content=one-ocean-foundation&preview=b21136a1bd90c99d2dea742e42d16b66&workflow=preview

many thanks

forgot to paste the JS

<script>
if ($( "#menu-menu" ).hasClass('w--open')) {
$( ".weglot-container" ).addClass( 'hidelang');
} else {
  $( ".weglot-container" ).removeClass( 'hidelang');
}
</script>

Hi @DEREIN1,

You could try this:

<script>
$( "#menu-menu" ).click(function(){
  $( ".weglot-container" ).toggleClass( 'hidelang' );
});

</script>

Make sure you add the CSS to head code as well:

.hidelang {
display: none !important;
}

Let me know how you go!

1 Like