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

150
Visualizações
In HTML, how to create a div with content that overflows borders and can be draggable?

Warning: I have absolutely no idea what the vocabulary is for what I am looking for.

I have the following page (jsfiddle) that contains a tree of nodes (familly tree).

The tree can grow very big and consequently have a undesirable display, to fit into the container div. The div limit in the fiddle is simulated by:

.tree {
    max-width: 500px;
}

I would like to achieve two goals:

  • Make sure that, even if the tree has a width bigger than the container witdh, it overflows the div borders.

I have looked into the overflow css keyword, but I do not understand on which element I should put it.

For example, when putting it in the tree class, the nodes keep staying in the predefined div size:

.tree {
  max-width: 500px;
  overflow: scroll;
}
  • Allow to drag the content of the (potentially overflowed) div in order to browse the tree (which I do not know how to do because I need to achieve the above point first... (dragable keyword ?))

Could you give me direction, based on my jsfiddle ?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Ok, I think the best solution would be to give the first ul a absolute position and set the tree to overflow: hidden;.

Then you would need to add a mouse / pointer listener to the tree that listenes to your mouse beeing dragged. The listener would change the position of the first ul based on your mouse drag, so you are moving around the tree.

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