Callbacks
In this example, we will show you how to use the onReady, onStateClick, onStateOver and onStateOut callbacks.
$(function() {
var onReadyAlert = document.querySelector('.onReady-alert');
$('#jsmap').JSMaps({
map: 'usa',
onReady: function() {
onReadyAlert.classList.remove('hidden');
},
onStateClick: function(state) {
console.log('JSMap onStateClick callback fired, here is the data passed to the callback function:');
console.log(state);
},
onStateOver: function(state) {
console.log('JSMap onStateOver callback fired, here is the data passed to the callback function:');
console.log(state);
},
onStateOut: function(state) {
console.log('JSMap onStateOut callback fired, here is the data passed to the callback function:');
console.log(state);
},
});
});
Code was copied successfully!