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

197
Vistas
How can I add animation to Bootstrap dropdowns?

How can I add animation to the dropdown? I assume by modifying popperConfig, but how?

At the moment dropdown-menu has a generated inline style, e.g. position: absolute; inset: 0px auto auto 0px; margin: 0px; transform: translate3d(0px, 40px, 0px);

Of course I can just add transition: translate .3s ease to it, but what if I want to change the direction or something more complex?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

In the current example, the dm-example will be the dropdown menu that shows up.
HTML will not differ much from its Bootstrap5 examples:

    <div class="dropdown">
        <button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton1" data-bs-toggle="dropdown" aria-expanded="false">
          Dropdown button
        </button>
        <ul id="dm-example" class="dropdown-menu " aria-labelledby="dropdownMenuButton1 ">
            <li><a class="dropdown-item " href="# ">Action</a></li>
            <li><a class="dropdown-item " href="# ">Another action</a></li>
            <li><a class="dropdown-item " href="# ">Something else here</a></li>
        </ul>
    </div>

For CSS animation rules handling:
#dm-example.show - describes initial styles for the block;
#dm-example.show .dropdown-item - describes initial styles for inner items;
dm-animation - is the animation on block;
item-animation - is the animation on items.

    <!-- Animate dropdown -->
     <style>
        #dm-example.show {
            position: fixed;
            animation-name: dm-animation;
            animation-duration: 2s;
        }
        
        #dm-example.show .dropdown-item {
            margin-bottom: 0;
            animation-name: item-animation;
            animation-duration: 2s;
        }
        
        @keyframes dm-animation {
            0% {
                margin-top: 0px;
            }
            50% {
                margin-top: 25px;
            }
            75% {
                margin-top: 5px;
            }
            100% {
                margin-top: 0px;
            }
        }
        
        @keyframes item-animation {
            0% {
                margin-bottom: 0px;
            }
            50% {
                margin-bottom: 25px;
            }
            75% {
                margin-bottom: 5px;
            }
            100% {
                margin-bottom: 0px;
            }
        }
    </style>
about 4 years ago · Juan Pablo Isaza Denunciar
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