Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 多个CustomMarker Google地图的问题_Javascript_Google Maps - Fatal编程技术网

Javascript 多个CustomMarker Google地图的问题

Javascript 多个CustomMarker Google地图的问题,javascript,google-maps,Javascript,Google Maps,我与第二个CustomMarker有问题。我可以在地图上看到路径,但是锚定点没有显示在我的自定义图像中。我错过了什么 第二个自定义标记的代码是: /* ***** Begin CustomMarker Toekomst ***** */ function CustomMarkerToekomst(latlng, map, marker_id, hovercard) { this.latlng_ = latlng; this.marker_id = marker_id; this.ho

我与第二个CustomMarker有问题。我可以在地图上看到路径,但是锚定点没有显示在我的自定义图像中。我错过了什么

第二个自定义标记的代码是:

/* ***** Begin CustomMarker Toekomst ***** */
function CustomMarkerToekomst(latlng, map, marker_id, hovercard) {
  this.latlng_ = latlng;
  this.marker_id = marker_id;
  this.hovercard_content = hovercard;
  this.setMap(map);
}

CustomMarkerToekomst.prototype = new google.maps.OverlayView();

CustomMarkerToekomst.prototype.draw = function() {
  var me = this;
  var div = this.div_;
  if (!div) {
    div = this.div_ = document.createElement('DIV'); 
        div.id=me.marker_id;
    var panes = this.getPanes();
    panes.overlayImage.appendChild(div);
  }
  var point = this.getProjection().fromLatLngToDivPixel(this.latlng_);
  if (point) {
      div.className = 'map-marker-toekomst show-hovercard';
      div.style.left = (point.x-6) + 'px';
      div.style.top = (point.y-23) + 'px';
      $(div).attr('data-hovercard-content', me.hovercard_content);

  }
};

CustomMarkerToekomst.prototype.remove = function() {
  if (this.div_) {
    this.div_.parentNode.removeChild(this.div_);
    this.div_ = null;
  }
};

CustomMarkerToekomst.prototype.getPosition = function() {
 return this.latlng_;
};
/* ***** Eind CustomMarker Toekomst ***** */
我对div‘MapMarker toekomst’的css是;我已证实背景确实存在:

.map-marker-toekomst {
position: absolute;
width: 21px;
height: 25px;
background: url(removed/img/mapmarker_blue.png) no-repeat;
cursor: pointer;
}
我的结果从php的数据库查询填充到javascript中,如下所示:

   echo "            pos = new google.maps.LatLng(" . $row['latitudedecimal'] . "," .  
$row['longitudedecimal'] . ");\n";
   echo "            overlay = new CustomMarkerToekomst(pos, map, \"" . $row['marker'] 
. "\", '" . $row['luchthavennaam'] . "');\n";
   echo "            overlay.setMap(map);\n";
   echo "            bounds.extend(pos);\n";
   echo "      \n";

我在这个脚本上面有一个类似的CustomMarker,它工作得很好,这是第二个问题。

您能提供复制问题的代码吗?还是显示问题的JSFIDLE?或者是一个实时地图的链接?嗨,geocodezip,无论出于什么原因,我都没有尝试过与上述内容相关的内容。但是,如果我将其更改为CustomMarkerAnkomst,在css中添加适当的信息,等等,它就可以工作了。。。这不是它应该被称为什么,但由于99.9%的人永远不会体验html代码,这不重要。