1. Home
  2. Knowledge Base
  3. Customization
  4. Trigger map actions with Javascript

Trigger map actions with Javascript

Reload the map

Use the following JS function after your page has fully loaded. This may be helpful if you are using a Caching or Page Preloading Plugin. Sometimes the preloading blocks the loading of the OUM map, so that it needs to be reloaded.

oumMap.invalidateSize();

Fly to another location

Use the following JS function after your page has loaded. The necessary parameters are latitude, longitude and zoom.

oumMap.flyTo([40.737, -73.923], 8);

Fly to the current user position

Use the following JS function to trigger a click on the “Show me where I am” Button.

document.querySelector('.leaflet-control-locate a').click();

Open the “Add location” form

Use the following JS function to trigger a click on the “+” Button to open the “Add location” form.

document.querySelector('#open-add-location-overlay').click();
Was this article helpful?

Related Articles


EN