Yes, you can have multiple images with imagemapster image maps, but I suspect you will have a very rough go of it if you try changing DOM elements on the fly.
Recall the difference in how jQuery works with injected elements vs. elements present at DOM creation. For injected elements, jQuery must use the .on()
method to trap their events, yes? Well, when you change DOM elements on the fly, you remove/reinject them in the DOM. Therefore, the plugin -- which was initialized to the previous element -- must now be initialized to the newly injected element, and it must be able to use .on()
tactics to manipulate that new element. That is asking quite a lot from a plugin.
However, all is not lost.
jsFiddle demo
Above jsFiddle is a working example, cobbled together from two of the developer's own examples, that shows a rough approximation of what you described in your question. Two image maps are on the same page, but one is initially hidden (I use only two images/imagemaps, but there could be several initially hidden, not just one).
When the first image map is clicked, in imagemapster's onClick callback, I hide the div that contains that image and unhide the next image div. It really is this simple:
var image = $('#vegetables');
image.mapster(
{
fillOpacity: 0.4,
onClick: function (e) {
var newToolTip = defaultDipTooltip;
$('#statemapDIV').show(); <====================
$('#veggieDIV').hide(); <====================
},
toolTipClose: ["tooltip-click", "area-click"],
areas: [
{
key: "dip",
toolTip: defaultDipTooltip
},
{
key: "asparagus",
strokeColor: "FFFFFF"
}
]
});
I hope this solution will work for you.