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

180
Views
javascript function in leaflet popup

I am trying to show a specific earthquake event when the user clicks on details in the popup (right now it just shows all of them)

    mymap.addLayer(markers);

    let template = `

    <h3>Earthquake</h3>
    <article><a href="/data/earthquakes_events.json">Details</a></article>
    `
    markers.bindPopup(template);

I have written this function to return the specific earthquake:

let earthquakes = earthquakes_events.json
function GetEarthquake (lat, long) {
    var index = earthquakes.findIndex(obj => obj.latitude == lat && obj.longitude == long)
    return earthquakes[index] // returns the whole object
}

Now I would like to use this function with the latitude and longitude info from the mouseevent but I don't know how

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!