How to add a class to the body element?

This is absolutely fantastic, thank you! I’m sure this will be very useful further down the line in my site development.

Actually, I’m not very advanced with coding, in particular javascript, I only learn what I need to know, and often forget it after a while!!!

I have come up with another solution, which is to have two menus positioned in exactly the same place, and hide each menu accordingly using Velo code to target and hide each menu element depending on the log in state. It’s a bit messy in the Editor UI, but it seems to do the trick.

I’ll leave the code here in case anyone else ever needs something similar:

import { authentication } from 'wix-members';

$w.onReady(function () {
  const loggedIn = authentication.loggedIn();

  if (loggedIn) {
    console.log('Logged in, hiding Visitors menu');
    $w('#horizontalMenu1').hide();
  }
  else {
    console.log('Logged out, hiding Members menu');
    $w('#horizontalMenu3').hide();  
    }

authentication.onLogin(() => {
    console.log('Logging in, hiding Visitors menu, showing Members menu');
    $w('#horizontalMenu1').hide();
    $w('#horizontalMenu3').show();
  });

});

Once again, thank you @Code-Ninjafor your patience and help.