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

271
Views
LEAFLET JS: Get Polyline ID on MouseOver

I want to move the mouse over an specific line of the polylines and get data of that line. I've been trying this for a while with no success, here is my code:

var allHover = L.polyline([
       [
         [45.51, -122.68],
         [37.77, -122.43],
         [34.04, -118.2]
       ],
       [
         [40.78, -73.91],
         [41.83, -87.62],
         [32.76, -96.72]
       ]
      ], {
      color: 'rgba(0,0,0,0)',
      weight: 15
    }).addTo(map);

allHover.on('mouseover', function(e) {
    var info = e.target;
    console.log(info);
}); 

allHover.on('mouseout', function() {
    console.log('mouse out');
}); 

The problem is that instead of getting just the data from one line, I get the full data. How can I solve that?

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!