【问题标题】:Remove box shadow from custom marker in google maps从谷歌地图中的自定义标记中删除框阴影
【发布时间】:2015-10-21 14:36:44
【问题描述】:

我为我正在开发的网站制作了一个自定义标记。它可以工作,只是标记需要是圆形的,在它周围显示一个盒子阴影。我需要删除盒子阴影。截图如下:

如何去除这些阴影并只留下标记的圆形部分可见? 这是我的标记代码(由于有多个标记,它是从 for 循环加载的):

for (i = 0; i < locations.length; i++) { 

        //string temp = builder.concat(i.toString());
      marker = new RichMarker({
        position: new google.maps.LatLng(locations[i]['lat'], locations[i]['lng']),
        map: map,
        content: '<img width="40" height="40" class="circ map-thumbnail" src="./img/testpic.jpg"/>',
        animation: google.maps.Animation.DROP
      });

      google.maps.event.addListener(marker, 'click', (function(marker, i) {
        return function() {
          infowindow.setContent(locations[i]['name']);
          infowindow.open(map, marker);
        }
      })(marker, i));


google.maps.event.addListener(marker, 'mouseover', function(event) {
    this.setZIndex(10);
});

google.maps.event.addListener(marker, 'mouseout', function(event) {
    this.setZIndex(0);
});



    }

这是css:

      img.map-thumbnail {
    cursor: pointer;
    border: 2px solid #ffffff;
}

.circ {
  border-radius:99px;
 -moz-border-radius:99px;
 -webkit-border-radius:99px;
  background:red;
  color:#fff;
  border:3px #fff solid;
  background-color: #e7676d;
  background-image: -webkit-gradient(linear, left top, left bottom, from(#e7676d), to(#b7070a)); /* Saf4+, Chrome */
  background-image: -webkit-linear-gradient(top, #e7676d, #b7070a); /* Chrome 10+, Saf5.1+, iOS 5+ */
  background-image: -moz-linear-gradient(top, #e7676d, #b7070a); /* FF3.6 */
  background-image: -ms-linear-gradient(top, #e7676d, #b7070a); /* IE10 */
  background-image: -o-linear-gradient(top, #e7676d, #b7070a); /* Opera 11.10+ */
  background-image: linear-gradient(top, #e7676d, #b7070a);
  filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#e7676d', EndColorStr='#b7070a'); 
 -webkit-box-shadow: none; /* Saf3-4 */
 -moz-box-shadow: none; /* FF3.5 - 3.6 */
  box-shadow: none; /* Opera 10.5, IE9, FF4+, Chrome 10+ */
  display:inline-block;
  padding:2px 2px 2px 2px ;
  margin:3px;
  font-family:arial;
  font-weight:bold;
   }

【问题讨论】:

    标签: javascript html css google-maps google-maps-api-3


    【解决方案1】:

    shadow: 'none' 添加到您的 RichMarker。

    marker = new RichMarker({
        position: new google.maps.LatLng(locations[i]['lat'], locations[i]['lng']),
        map: map,
        content: '<img width="40" height="40" class="circ" src="./img/testpic.jpg"/>',
        animation: google.maps.Animation.DROP,
        shadow: 'none'
    });
    

    【讨论】:

    猜你喜欢
    • 2011-04-22
    • 1970-01-01
    • 2015-06-05
    • 1970-01-01
    • 1970-01-01
    • 2012-11-29
    • 2013-04-10
    • 2015-04-09
    • 1970-01-01
    相关资源
    最近更新 更多