简体   繁体   English

在div下使用gmaps在CSS下创建箭头

[英]create arrow below div with css using gmaps

I want to create an arrow under the div like this: 我想像这样在div下创建一个箭头:

https://hpneo.github.io/gmaps/examples/overlays.html https://hpneo.github.io/gmaps/examples/overlays.html

and i'm using the same code and i took the css from the source: 我使用的是相同的代码,我从源代码中提取了CSS:

.overlay{
  display:block;
  text-align:center;
  color:#fff;
  font-size:60px;
  line-height:80px;
  opacity:0.8;
  background:#4477aa;
  border:solid 3px #336699;
  border-radius:4px;
  box-shadow:2px 2px 10px #333;
  text-shadow:1px 1px 1px #666;
  padding:0 4px;
}

.overlay_arrow{
  left:50%;
  margin-left:-16px;
  width:0;
  height:0;
  position:absolute;
}
.overlay_arrow.above{
  bottom:-15px;
  border-left:16px solid transparent;
  border-right:16px solid transparent;
  border-top:16px solid #336699;
}
.overlay_arrow.below{
  top:-15px;
  border-left:16px solid transparent;
  border-right:16px solid transparent;
  border-bottom:16px solid #336699;
}

So i noticed that i needed a div with the class overlay_arrow so i made some modifications to the gmaps code: 所以我注意到我需要一个带有overlay_arrow类的div,因此我对gmaps代码做了一些修改:

    map.drawOverlay({
                lat: destinations[i].Latitude,
                lng: destinations[i].Longitude,
                content: '<div class="overlay" id="' + destinations[i].Id + '">' + destinations[i].Name + '<div class="overlay_arrow"></div></div>'
            });

but still no arrow under the div. 但div下仍然没有箭头。

What am i missing here? 我在这里想念什么?

在此处输入图片说明

Looks like you need to add either the above or below class to the overlay_arrow div. 看起来您需要将上层或下层类添加到overlay_arrow div中。 At the moment the arrow styles are not actually being set. 目前,实际上尚未设置箭头样式。

For example: 例如:

   map.drawOverlay({
                lat: destinations[i].Latitude,
                lng: destinations[i].Longitude,
                content: '<div class="overlay" id="' + destinations[i].Id + '">' + destinations[i].Name + '<div class="overlay_arrow below"></div></div>'
            });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM