Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

272
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda