2
votes

I have a map where I have multiple pushpins, and would like the infobox to support HTML content. I'm using the native infobox class, and while I have used a custom infobox, as many have suggested, I'd like to figure this one out.

The code is at: http://brickenandassociates.com/bm.php

Its not compressed or encoded, so you can just view the source.

at line 84, the options for the Infobox are set. In the description, I've tried setting a var , but am missing the syntax somewhere. Something like this :

var ibDescription = document.getElementById('ibDescription'); ibDescription.innerHTML = e.target.description;

Any guidance would be most appreciated !

1
I traveled a different route and used a custom infobox. It just needed to get done. Here are the results: brickenandassociates.com/pin_test3.php Here's how I found the center and then centered the box starting at line 682: // divide width and heighth viewportwidth = viewportwidth /2; viewportheight = viewportheight /2; infoBox.style.top = (viewportheight - 320) + "px"; infoBox.style.left = (viewportwidth - 225) + "px"; infoBox.style.visibility = "visible"; document.getElementById('myMap').appendChild(infoBox); }greenkoi

1 Answers

0
votes

Looks like you've figured this out already:

pinInfobox.setOptions({title: e.target.Title, description: e.target.Description, visible:true, offset: new Microsoft.Maps.Point(0,25)});

pinInfobox.setLocation(e.target.getLocation());

One thing I noted was that you are only using one InfoBox. I use one info box per pushpin, so I set the infobox detail at the time it is created and then only have to hide or show it.