The marker is an HTML element and has the attr identifier “data-marker-id”. Below is an example of using it to play a sound after clicking on a marker.
const plugin = this;
const $ = jQuery;
plugin.$container.on('click', '.ipnrm-marker', (e) => {
const $marker = $(e.currentTarget);
const markerId = $marker.attr('data-marker-id');
const scene = plugin.viewer.sceneActive;
if(scene) {
const marker = scene.cfg.markers.find(x => x.id === markerId);
if(marker) {
// console.log(marker.data); // if you want to use data from the marker "data" section
const audio = new Audio('https://assets.mixkit.co/active_storage/sfx/940/940-preview.mp3');
audio.play();
}
}
});
Paste this code into the js section of a virtual tour and test