ArcGIS JS API 3.21信息模板缩放按钮

ArcGIS JS API 3.21信息模板缩放按钮,gis,arcgis,arcgis-js-api,Gis,Arcgis,Arcgis Js Api,有没有人幸运地将单击事件附加到InfoTemplate的HTML中构建的自定义按钮上?以下是我的信息模板HTML: uploadInfoTemplate = new InfoTemplate ({ title: "", content: "<strong>Segment:</strong> ${segment}" + "<hr/>" + "<strong>Time:</str

有没有人幸运地将单击事件附加到InfoTemplate的HTML中构建的自定义按钮上?以下是我的信息模板HTML:

uploadInfoTemplate = new InfoTemplate ({
    title: "",
    content: "<strong>Segment:</strong> ${segment}" +
             "<hr/>" +
             "<strong>Time:</strong> <i>${dateTime}</i>" +
             "<div style='width: 100%; text-align:right;'>" +
                 "<input class='zoomButton' type='button' value='Zoom to' />" +
             "</div>"
});
uploadInfoTemplate=新建InfoTemplate({
标题:“,
内容:“段:${Segment}”+
“
”+ “时间:${dateTime}”+ "" + "" + "" });

然后,我在默认信息模板(即zoomTo链接)上隐藏了一些项目。我想简单地用一个按钮替换zoomTo的功能,使它看起来更漂亮。

如果您只是想改善“缩放到”按钮的外观,几行CSS就可以做到这一点:

a.action.zoomTo {
  color: #fff;
  text-decoration: none;
  background-color: #a8abaf;
  border: solid #a8abaf;
  border-radius: 5px;
}
    a.action.zoomTo:hover{
      background-color: #898b8e;
      border: solid #898b8e;
    }

如果您只是想改善“缩放到”按钮的外观,那么几行CSS就可以做到这一点:

a.action.zoomTo {
  color: #fff;
  text-decoration: none;
  background-color: #a8abaf;
  border: solid #a8abaf;
  border-radius: 5px;
}
    a.action.zoomTo:hover{
      background-color: #898b8e;
      border: solid #898b8e;
    }

对不起@Jeremy Swagger

我忘了我已经解决了这个问题,忘了更新我的问题。我想出了这样一个解决方案:

if(this.zoomButton) {
    domConstruct.destroy(this.zoomButton);
{

var zoomToButtonHTML = '<div style="width 100%;"><input class="zoomButton" type="button" value="Zoom to" /></div>';

this.zoomButton = domConstruct.create("div", {
    "class": "action",
    "id": "uploadLink",
    "innerHTML": zoomToButtonHTML
}, query(".actionList, this.map.infoWindow.domNode)[0]);

var self=this;
on(this.zoomButton, 'click', function(evt) {
    self._zoomToPoint(evt. self.map);
});

我很抱歉@Jeremy Swagger

我忘了我已经解决了这个问题,忘了更新我的问题。我想出了这样一个解决方案:

if(this.zoomButton) {
    domConstruct.destroy(this.zoomButton);
{

var zoomToButtonHTML = '<div style="width 100%;"><input class="zoomButton" type="button" value="Zoom to" /></div>';

this.zoomButton = domConstruct.create("div", {
    "class": "action",
    "id": "uploadLink",
    "innerHTML": zoomToButtonHTML
}, query(".actionList, this.map.infoWindow.domNode)[0]);

var self=this;
on(this.zoomButton, 'click', function(evt) {
    self._zoomToPoint(evt. self.map);
});