I'm having trouble getting Infobox for Bing API to open with a click outside the map.
Function Performance Infobox (E) {pinInfobox.setOptions ({title: e.target. Title, description: e.target.Description, view: true, offset: new Microsoft.Maps.Point (0, 25)} ); PinInfobox.setLocation (e.target.getLocation ()); } Hide the function infobox (e) {pinInfobox.setOptions ({view: incorrect}); } Function displayPinsOnMap (Results) {// Creates archive to store multiple pins var pin = new Microsoft.Maps.EntityCollection (); // info box for pushpin var infoboxOptions = {width: 260, height: 160}; PinInfobox = New Microsoft.Maps.Infobox (new Microsoft.Maps.Location (0, 0), InfoBox option); InfoboxLayer.push (pinInfobox); // Create PIN for (var i = 0; i & lt; result.lamper; i ++) {// pushpin position var status = new Microsoft. Map. Location (result [i] ["kick"], result [i] ["loan"]); // Create PIN (result [i] ["DNC"] == 'DNC') {var sppins = {html content: "& lt; img src = 'badsp.png' height = '32px' & gt;"} ; } And {var sppins = {html content: "& lt; img src = 'sppin.png' height = '32px' & gt;"}; } Var pin = New Microsoft.Maps.Pushpin (status, sppins); Pin.Title = Result [i] ["Business Name"]; Pin.Description = results [i] ["address"] + "& lt; br & gt;" + Results [i] ["city"] + "," + result [i] ["state listing"] + "
+ Results [i] ["phone"] + "& lt; br & gt; fax:" + result [i] ["fax"] + "
Email:" + result [i] [ "E-mail"]; Microsoft.Maps.Events.addHandler (pin, 'click', displayInfobox); Click the Function Pin (i) {Microsoft.Maps.Events.addHandler (Results [i], 'Click'); } // add map to map.entities.push (pin); } // Map Hide Microsoft at Microsoft Box Aventus.EdHandler (Map, 'ViewWort', Hide Infobox); // Add Pin / Infobox map.entities.push (PininFobox); }
I have a list of items removed from the JSON file and displayed on the map. Each item builds on a pin and info box as well as on the edge of the map in the table. What I need to do is, to open Infobox associated with that company, I need it, from the table, click on the name of the company. It's been told here that in the last time I did it with Google API - it seems that does not work like that for Bing (yes I have to use Bing).
"" + '& lt; A href = "#" onclick = "javascript: displayInfobox ('+ (i) +'); & gt; + Result [i] ["business name"] + '& lt; / a & gt;' + "& Lt; / Td> "
It looks like you have opened the displayInfobox function with some code Copy is expected which is trigerred when someone clicks the pushpin because that function contains this code:
pinInfobox.setLocation (e.target.getLocation ());
The getLocation () method is present on the Bing Maps pushpin object but is not clearly on you, when it will fail in that line (using your own debug tool using the right tool?) It will change so that it will get the location of Infobox to look elsewhere, or you can create new Bing Maps Location Object by using letters with letters as some attributes and by using them or by looping them through all the pins This map, which matches you in some way
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment