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

160
Views
Drag element to other page

Im trying to achieve behaviour where user could drag elements from a leaflet map to other page where there is another map.

To be able to drag out of the map and go hover over link in a navbar which after one second time redirects me to the other page, I did these steps:

1 - The whole page has onmousemove event listener (when dragging is active).

2 - When I want to start dragging some polygon from the map, I actually create a new element (looking similiar to the one in the map) with absolute position and the onmousemove listener is setting its position based on the cursors position.

3 - After hovering over the link and being redirected to the other page, after the reload, I reconstruct the "dragged" element and I re-add the onmousemove event listener (as in step 1). BUT because it should be drag n drop like experience, the user is still holding the left-mouse button down and the re-added onmousemove event listener starts doing its think only after user stop holding the left-mouse button down.

What I'd like to achieve is that the re-added onmouse event listens from the very beginning even if left-mouse button is down all the time during the page load. Or if there is other way how to go around this.

Thank you

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