简体   繁体   中英

esri map display info window without clicking on the map

I'm using the esri map javascipts API. I want to show a info window on the map. However, in the example given by esri, the user must need to click on the map to show the info window. Because in the example, one of the parameter is the screenPoint, which must be obtained by clicking on the map. Can i just click on a button to show a info window in a specific location? Thanks!

dojo.connect(map.graphics, "onClick", function(evt) {
      var g = evt.graphic;
      map.infoWindow.setContent(g.getContent());
      map.infoWindow.setTitle(g.getTitle());
      map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
    });

Yes, the first parameter to the map.infoWindow.show() method is just a screen point location. Here's a link to the documentation on the Point object: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/point.htm , which is what you pass in for that parameter. For example: new esri.geometry.Point(-118.15, 33.80, map.spatialReference);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM