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

141
Vistas
Boostrap 5 collapse set show instead of toggle and allow anchor execution

Is there a way via the html attributes to have a link that will only "open" a collapsible target (if it's already open then just just stays open) and anchor link to it with the hashtag.

When I add "data-bs-toggle" my anchor href="#dashboard-VC" doesn't work. <a class="btn" href="#dashboard-VC" data-bs-toggle="collapse" data-bs-target="#dash-VC">{{NAME}}</a>

I can add this JS to move the screen but I wanted to avoid having to add this if there's a way to tell BS5 to allow the click event to bubble through without writing extra JS <a class="btn" href="#dashboard-VC" onclick="document.getElementById('dashboard-VC').scrollIntoView();" data-bs-toggle="collapse" data-bs-target="#dash-VC">{{NAME}}</a>

Now the next one is I want this to only "open" the collapsible area not toggle it. This button is a shortcut at the top of the page that will scrolldown to bring this area into view and "open" it if it's not already open. I can write JS to do everything but I was hoping to keep it all JS free and just use BS5 HTML attributes to handle it but not sure if that's possible.

I tried data-bs-toggle="open" but that's not a thing hoping it just wasn't documented. Maybe there's something other then the collapse competent that would handle this better?

Here is a working example but all in JS which is what I wanted to avoid having in the code: <a class="btn" href="#dashboard-VC" onclick="document.getElementById('dashboard-VC').scrollIntoView();document.getElementById('dash-VC').classList.add('show')">{{NAME}}</a>

Thanks.

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