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

268
Views
How can I update the pins on a google map using fetch each time a slide changes?

I have a Google map set up in a Slider Revolution slider and it pulls locations from a database. I have it set up so that it updates every 10 seconds, which works, but it seems that any time it runs and the map slide is not active, the pins disappear until the next time it updates. I would like it to update after each slide change.

This is the code that works for updating every 10 seconds:

function fetch(){
  var mapsvg = this;
  setInterval(()=>{ 
  mapsvg.database.find() 
  }, 133000);
}
fetch();

This is the code that I tried to use for updating after slide change:

revapi2.bind("revolution.slide.onafterswap",function fetch(){
     var mapsvg = this;
    mapsvg.database.find();
 
})
fetch();

I get two errors with this code:

Uncaught (in promise) TypeError: Window.fetch: At least 1 argument required, but only 0 passed

and

Uncaught TypeError: mapsvg.database is undefined

Any help would be most appreciated.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

In the event listener of Slider Revolution, you reference "this" which is the Slider Revolution object itself in that case. That object has no "database" attribute, so it fails.

You don't need to call fetch() in the second part, since the database.find() function will be called on slide swap event anyway.

As best you define global the mapsvg reference and in the Slider Revolution event listener just call mapsvg.database.find();

If you wish, drop a link to the current page, and I can give you an exact description of how to do it.

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!