gpt4 book ai didi

javascript - 标签显示在标记上方 - MarkerWithLabel

转载 作者:行者123 更新时间:2023-11-28 00:46:04 24 4
gpt4 key购买 nike

Javascript(请参阅 MarkerWithLabel 文档)

var marker1 = new MarkerWithLabel({
position: homeLatLng,
draggable: true,
raiseOnDrag: true,
map: map,
labelContent: "$425K",
labelAnchor: new google.maps.Point(22, 0),
labelClass: "marker", // the CSS class for the label
labelStyle: {opacity: 0.75}
});

CSS:

.marker {
color: #fff;
font-size: 16px;
line-height: 23px;
min-width: 36px;
text-align: center;
white-space: nowrap;
}

请查看截图 - /image/YM0Uq.jpg标签始终位于标记之前。

JSFIDDLE

可以修复吗?谢谢。

最佳答案

MarkerWithLabel.js中:

找到这个:

this.getPanes().overlayImage.appendChild(this.labelDiv_);
this.getPanes().overlayMouseTarget.appendChild(this.eventDiv_);
// One cross is shared with all markers, so only add it once:
if (typeof MarkerLabel_.getSharedCross.processed === "undefined") {
this.getPanes().overlayImage.appendChild(this.crossDiv_);
MarkerLabel_.getSharedCross.processed = true;
}

更改为:

this.getPanes().markerLayer.appendChild(this.labelDiv_);
this.getPanes().overlayMouseTarget.appendChild(this.eventDiv_);
// One cross is shared with all markers, so only add it once:
if (typeof MarkerLabel_.getSharedCross.processed === "undefined") {
this.getPanes().markerLayer.appendChild(this.crossDiv_);
MarkerLabel_.getSharedCross.processed = true;
}

关于javascript - 标签显示在标记上方 - MarkerWithLabel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27364532/

24 4 0