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

146
Views
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 answers
Answer question

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 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!