Make collapsed elements visible on my website

Question:
I want to use this script to make collapsed elements visible on my website.

Product:
Wix Editor

What are you trying to achieve:
I want to use this script to make collapsed elements visible on my website.

What have you already tried:
When I mark the elements as hidden, the script works fine

Additional information:

import wixData from 'wix-data';

//Meerdere betaalmiddelen
$w.onReady(function () {
  const switchId = '#switch1';
  const boxId = '#box4';

  $w(switchId).onChange((event) => {
    const switchValue = event.target.checked; // Hier halen we de boolean-waarde op

    // Controleer de waarde van de switch en toon/verberg de box dienovereenkomstig
    if (switchValue) { // Als switch aan staat (true)
      $w(boxId).show();
    } else { // Als switch uit staat (false)
      $w(boxId).hide();
    }
  });
})
``
//Einde meerdere betaalmiddelen

i found the problem :face_with_peeking_eye:
The “show” and “hide” options should be Expand and Collapse

1 Like