The MapsAlive JavaScript API (Application Programming Interface) lets you:
- Change and restore the appearance of a hotspot marker
- Close a popup
- Draw a route
- Flush the Live Data cache
- Get the current hotspot
- Get the current map
- Get all the hotspots that have a specified category
- Handle a mouse click in the directory
- Execute code when the selected hotspot changes
- Execute code when the map loads
- Play sounds
- Position a zoomed-in map to bring a hotspot into view
- Zoom the map in or out
- Make a marker blink
- Disable or enable a marker
- Hide or show a marker
- Make a marker static
- Change a marker's stacking order
- Change the tour title text.
- Make a hotspot become selected
The API is fully documented in the MapsAlive User Guide for the JavaScript API.
See samples of the JavaScript API in action:
How do I make the map zoom when a marker is clicked?
You can use the JavaScript API to make the map zoom in when a marker is clicked. To do this
- Click in the menu.
- Choose in the Click Action dropdown list.
- Add the following JavaScript API calls to the JavaScript text area:
mapsalive.setMapZoomLevel(100);
mapsalive.setMarkerSelected("h2");
This first call zooms the map to 100%. The second call will cause the map position to shift if necessary to make sure the marker is visible at 100% zoom. Replace "h2" with the Hotspot Id for the marker.
To learn more about the JavaScript API, see the MapsAlive User Guide for JavaScript API.
How do I add effects to a marker?
- Click in the menu.
- Click the marker style name in the list to go to the screen.
- Add the effects to the Normal Effects and Selected Effects fields.
To learn about what effects and options are available see the MapsAlive User Guide to the JavaScript API.
How do I play a sound (audio)?
See the SoundManager section in the MapsAlive User Guide for JavaScript API.
Note: The MP3 files containing your sounds must be located at a URL somewhere on the internet. MapsAlive does not provide a way for you to upload or store audio files.
How do I add Custom HTML to my tour?
Choose in the menu.
You can add CSS, JavaScript, and HTML in the text boxes on the Custom HTML screen.
How do I draw a route?
You draw a route by calling the drawRoute JavaScript API function. To learn more, see the MapsAlive User Guide for the JavaScript API and also the MapsAlive User Guide for Drawing Routes.
How do I assign an action to a mouse event for a hotspot?
- Click in the menu.
- Choose an action from one or more of the action dropdown lists (click, mouseover, or mouseout).
- Provide information about the action e.g. a URL to open in a browser window or JavaScript code to execute.
Can I integrate MapsAlive with my database?
Yes. The Live Data feature lets you access your own database through Javascript calls and view updated data in real time. Learn More.
Note: The Live Data feature is included in the Pro Plan.
| |
|