谷歌地图标记labelClass动画无法正常工作

时间:2015-10-19 19:13:02

标签: angularjs google-maps angular-google-maps

我正在研究this project。我有angular-google-map指令。我正在用labelClass覆盖默认标记。 CSS工作正常但不会悬停。

.marker {
    color: white;
    border: 2px white solid;
    border-radius: 50px;
    text-align: center;
    font-size: 20px;
    letter-spacing: 0.1em;
    font-weight: bold;
}

.marker:hover {
    background-color: #C52183;
    animation: pulse 1s;
}

/* ANIMATIONS */
@keyframes pulse {
  50% {

    transform: scale(4);
  }

  100% {

    transform: scale(1);
  }
}

如果您查看示例,则可以看到动画,但不能看到真实的颜色。我有时会得到真正的动画。 整个项目是here

pd:问题不能是动画,如果我只是尝试更改一些css属性我没有效果,所以我认为问题是谷歌地图和CSS。

1 个答案:

答案 0 :(得分:0)

我终于解决了这个“错误”。

问题出在MarkerWithLabel库上,但实际上并不是一个bug,它只是不可能(使用这个库)。检查库我们看到:

  // Set up the DIV for handling mouse events in the label. This DIV forms a transparent veil
  // in the "overlayMouseTarget" pane, a veil that covers just the label. This is done so that
  // events can be captured even if the label is in the shadow of a google.maps.InfoWindow.
  // Code is included here to ensure the veil is always exactly the same size as the label.
  this.eventDiv_ = document.createElement("div");
  this.eventDiv_.style.cssText = this.labelDiv_.style.cssText;

我刚刚修改了库,所以我不再创建不可见的div,而且我还用真实标签拦截事件。现在它正在我的要求下工作。

more info about the problem

demo working