首页 > 解决方案 > 在 Google Maps API 中创建图像按钮

问题描述

我想使用 Google Maps JavaScript API 在我的 Google Maps 中插入一个徽标,该徽标悬停在地图上并链接到网站。我已经知道如何创建按钮,但不知道如何将图像插入这些按钮。我该怎么做?

标签: javascriptimageapibuttonmaps

解决方案


您可以使用绝对位置属性和 z-index 属性使元素出现在地图上。请参阅链接的 jsFiddle

 #map_div{
  z-index : 0;
 }
img{
  position : absolute;
  display : inline;
  top : 100px;
  left : 100px;
  z-index : 1;
}

见 jsFiddle http://jsfiddle.net/4mtyu/8774/


推荐阅读