簡體   English   中英

在div下使用gmaps在CSS下創建箭頭

[英]create arrow below div with css using gmaps

我想像這樣在div下創建一個箭頭:

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

我使用的是相同的代碼,我從源代碼中提取了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;
}

所以我注意到我需要一個帶有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>'
            });

但div下仍然沒有箭頭。

我在這里想念什么?

在此處輸入圖片說明

看起來您需要將上層或下層類添加到overlay_arrow div中。 目前,實際上尚未設置箭頭樣式。

例如:

   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