我正在尝试使我当前正在盘旋的标记具有比其他标记更大的z-index,因此即使它被其他标记隐藏,当我将鼠标悬停在其上时它也将获得完全可见性.
点击任何标记我想做同样的事情.
google.maps.event.addListener(this.marker, 'mouseover', function() {
this.old_ZIndex = this.getZIndex(); //trying to get the current z- index
console.log(this.old_ZIndex); //this is undefined: why?
this.setZIndex(this.old_ZIndex + 100); //setting a higher z-index than all other markers
console.log("the old z index is ",this.old_ZIndex);
});
Run Code Online (Sandbox Code Playgroud)
但是有了这个,我将无限增加z索引..还有一些其他的方式,当我悬停或点击任何其他标记时,我可以恢复..
或者有更好的方法来实现它?