Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

217
Visualizações
Reveal more text on click for multiple "show more" buttons. Duplicate didn't work

This opens more text when I click a button. Now I need more of these on a web page. I duplicated the function and renamed in const lines the names to menubutton2 and dropdownmenu3 but the second button doesn't work

import wixAnimations from 'wix-animations';

$w.onReady(function() {
  activeMenu();
});

function activeMenu() {
  const menuButton = $w('#menuButton');
  const dropdwonMenu = $w('#dropdownMenu');
  const dropdownBoxHeight = 0;
  const dropdownAnimation =
    wixAnimations.timeline().add(dropdwonMenu, {
      y: 0,
      duration: 100
    });

  wixAnimations.timeline().add(dropdwonMenu, {
    y: -
      dropdownBoxHeight
  }).play();

  menuButton.onClick(() => {
    dropdwonMenu.collapsed ? openMenu() : closeMenu();
  });

  dropdownAnimation.onReverseComplete(() => {
    dropdwonMenu.collapse();
  });

  function openMenu() {
    dropdwonMenu.expand().then(() => {
      dropdownAnimation.play();
    })
  }

  function closeMenu() {
    dropdownAnimation.reverse();
  }
}

import wixAnimations from 'wix-animations';
$w.onReady(function() {
  activeMenu();
});

function activeMenu() {
  const menuButton = $w('#menuButton2');
  const dropdwonMenu = $w('#dropdownMenu2');
  const dropdownBoxHeight = 0;
  const dropdownAnimation =
    wixAnimations.timeline().add(dropdwonMenu, {
      y: 0,
      duration: 100
    });

  wixAnimations.timeline().add(dropdwonMenu, {
    y: -
      dropdownBoxHeight
  }).play();

  menuButton.onClick(() => {
    dropdwonMenu.collapsed ? openMenu() : closeMenu();
  });

  dropdownAnimation.onReverseComplete(() => {
    dropdwonMenu.collapse();
  });

  function openMenu() {
    dropdwonMenu.expand().then(() => {
      dropdownAnimation.play();
    })
  }

  function closeMenu() {
    dropdownAnimation.reverse();
  }
}


       
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda