Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

203
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda