[Pro] Custom Click Actions

You are here:

In the Pro version you’re able to execute custom Javascript when the marker or region is clicked. The click will trigger a javascript function that will take one parameter, which is an object containing the data for that marker or region.

The function that will run will be similar to the following:

function customCodeExample( data ) {
    ... your custom code ....
}

So you should use the parameter data in your custom code. Example of a data object:

name: "US"
id: "US"
tooltipContent: "click for more info"
content: "this is the special content for US"
action: "customRegionAction"
value: ""
mapID: "7130"

So if you want to use the content you would use for example:

alert( data.content );

In the editor screen you would have something like:

Screenshot for custom code

So the final code that will run will be the following:

function customCodeExample( data ) {
    alert( data.content );
}