Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

297
Views
Función Slate Docs para mantener abierto el acordeón de navegación al hacer clic en otros enlaces en la barra lateral

Para UX, puede haber ocasiones en las que se deban abrir varias secciones a la vez en la barra lateral. Actualmente, cuando se hace clic en el encabezado de otra sección en la barra lateral, otras secciones colapsan. ¿Cómo hago para que todas las secciones se abran y cierren solo cuando hago clic en el encabezado de la sección?

ingrese la descripción de la imagen aquí

ingrese la descripción de la imagen aquí

Este es el código que maneja esto:

var $mejor = $toc.find("[href='" + mejor + "']").first();

 if (!$best.hasClass("active")) { // .active is applied to the ToC link we're currently on, and its parent <ul>s selected by tocListSelector // .active-expanded is applied to the ToC links that are parents of this one $toc.find(".active").removeClass("active"); $toc.find(".active-parent").removeClass("active-parent"); $best.addClass("active"); $best .parents(tocListSelector) .addClass("active") .siblings(tocLinkSelector) .addClass("active-parent"); $best.siblings(tocListSelector).addClass("active"); $toc.find(tocListSelector).filter(":not(.active)").slideUp(150); $toc.find(tocListSelector).filter(".active").slideDown(150); if (window.history.replaceState) { window.history.replaceState(null, "", best); } var thisTitle = $best.data("title"); if (thisTitle !== undefined && thisTitle.length > 0) { document.title = thisTitle.replace(htmlPattern, "") + " – " + originalTitle; } else { document.title = originalTitle; } }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Las 2 líneas siguientes son donde se cierra la sección previamente seleccionada.

 $toc.find(".active").removeClass("active"); $toc.find(".active-parent").removeClass("active-parent");

Coméntelos y cada sección recordará abierta.

EDITAR: para poder cerrar la sección cuando hace clic en ella, debe reemplazar el método .addClass por la documentación de toggleClass . De esta forma se añade la clase active si no está presente y se elimina en caso contrario.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!