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

229
Visualizações
Keep Submenu On Bottom of your screen when menu is scrollable

I have created one vertical scrollable menu which will include many main categories.
When someone mouseover, over a main category then it will show him one submenu. I want this submenu to have the same height as the main category.
But when the main menu is scrolled then the submenu exceeds the height. It is done in a way not to exceed the height and to lock at the bottom?
I am sending you some images to understand the problem.
correct correct
Now some images when main menu scrolling
wrong wrong

My twig-html code is:

<div class="dd_menu">
   <ul class="nav-main">
      {% for item in menuProducts.items %}
      <li class="nav-main-item {{ item.classes|join(' ') }}">
         {% set term = Term(item.object_id) %}
         <div class="submenu__image"></div>
         <a class="dd_menu_a" href="{{ item.link }}">{{ item.title }}
         <i class="fa fa-angle-right arrow_icon"></i>
         </a>
         {% if item.children %}
         <div class="nav-drop">
            <ul>
               {% for child in item.children %}
               <li class="nav-drop-item">
                  <a href="{{ child.link }}">{{ child.title }}</a>
               </li>
               {% endfor %}
            </ul>
         </div>
         {% endif %}
      </li>
      {% endfor %}
   </ul>
</div>

My css code code is:

.nav-drop {
    position: absolute;
    top: 0;
    left: 100%;
    width: 100%;
    background: #fff;
    display: none;
    text-align: center;
    padding: 20px 0 20px 0;
    background: #fff;
}

.dd_menu ul li a.dd_menu_a.active + .nav-drop{
    display: block;
}

My javascript code code is:

var dd_menu_a = document.querySelectorAll(".dd_menu_a");

dd_menu_a.forEach(function(dd_menu_item){
    dd_menu_item.addEventListener("mouseover", function(){
        dd_menu_a.forEach(function(dd_menu_item){
            jQuery(".nav-main__brands__items").removeClass("active");
            dd_menu_item.classList.remove("active");
        })
        dd_menu_item.classList.add("active");
    })
})
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Even though im not fully sure what you are trying to accomplish here but for submenus like in the screenshots you've shown, it is more convenient and wise to use ::after pseudo-element. So I recommend checking it out

about 4 years ago · Juan Pablo Isaza Relatório
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