2017-05-05 45 views
0

谷歌地圖的div我有這種情況發送回

enter image description here

試圖登錄時,彈出出來。我想這是繼谷歌地圖的div

所以,這是我的彈出

.popup-inner { 
    max-width:500px; 
    width:90%; 
    padding:40px; 
    position:absolute; 
    top:50%; 
    left:50%; 
    -webkit-transform:translate(-50%, -50%); 
    transform:translate(-50%, -50%); 
    box-shadow:0px 2px 6px rgba(0,0,0,1); 
    border-radius:3px; 
    background:#fff; 
    z-index:9999999; 

的風格,同時背部變得

.popup { 
    width:100%; 
    height:100%; 
    display:none; 
    position:fixed; 
    top:0px; 
    left:0px; 
    background:rgba(0,0,0,0.75); 
} 

,這是彈出

<div class="popup" data-popup="popup-1"> 
      <div class="popup-inner"> 

       <form action="#" th:action="@{/}" method="post" class="form-signin"> 

        <div class="form-group"> 
//content of the form... 
         </div> 

       </form> 
       <p> 
        <a data-popup-close="popup-1" href="#">Close</a> 
       </p> 
       <a class="popup-close" data-popup-close="popup-1" href="#">x</a> 

      </div> 

     </div> 

這張地圖有一個簡單的,而流行的

<div id="map"></div> 

這種風格

#map { 
    width:100%; 
    height: 600px; 
    z-index: 1; 
} 
+0

你爲什麼不把'map'內'popup'格? – mxr7350

+0

,因爲彈出窗口出現在應用程序的每個頁面中,不僅在這個地圖上,所以它被Thymeleaf片段 – besmart

回答

0

只需添加z-index:2;.popup

.popup { 
    z-index:2; 
} 
+0

這是正確的答案!感謝所有的幫助! – besmart

0

有沒有在你的代碼的一些變化,看看我的片段也有一些,你應該閱讀評論。

希望這會爲你做的工作!

.popup { 
 
    /*display:none; //change it back to its original*/ 
 
    display:block; 
 
    width:100%; 
 
    height:100%; 
 

 
    top:0px; /* 0px is 0 by default cause there does not exist 0 pixels. So only 0 is ok */ 
 
    left:0; 
 
    background:rgba(0,0,0,0.75); 
 
} 
 
    
 
.popup-inner { 
 
    position:fixed; /* changed position: absolute to fixed */ 
 
    width:90%; 
 
    max-width:500px; 
 
    
 
    top:50%; 
 
    left:50%; 
 
    
 
    padding:40px; 
 
    
 
    -webkit-transform:translate(-50%, -50%); 
 
    transform:translate(-50%, -50%); 
 
    box-shadow:0px 2px 6px rgba(0,0,0,1); 
 
    border-radius:3px; 
 
    background:red; 
 
    z-index: 10; 
 
} 
 

 
    
 
    
 
#map { 
 
    width:100%; 
 
    height: 600px; 
 
    z-index: 1; 
 
    background-color: pink; /* used to check the positions, make sure to remove the line */ 
 
}
<div class="popup" data-popup="popup-1"> 
 
    <div class="popup-inner"> 
 

 
    <form action="#" th:action="@{/}" method="post" class="form-signin"> 
 

 
    <div class="form-group"> 
 
     //content of the form... 
 
    </div> 
 

 
    </form> 
 
    <p> 
 
     <a data-popup-close="popup-1" href="#">Close</a> 
 
    </p> 
 
    <a class="popup-close" data-popup-close="popup-1" href="#">x</a> 
 

 
    </div> 
 

 
</div> 
 

 
<div id="map"></div>

+0

調用,這個設置,彈出窗口始終打開,背景總是黑暗的,彈出窗口留在地圖下... – besmart

+0

這是因爲display:block;應顯示:無;並需要由JQ或其他東西觸發。但我看到你找到正確的答案(y) – dutchsociety

+0

謝謝:) – besmart