Javascript Can';t在底图前面显示模式窗口
我试图在我的地图前面显示一个模式窗口,但它不起作用(我猜它发生在基本地图后面)。如果我移除贴图容器和tilelayer,它会工作得很好。我不知所措。这是一个简单的订购问题还是更复杂的问题(我过去曾遇到过与传单的兼容性问题) HTML JAVASCRIPTJavascript Can';t在底图前面显示模式窗口,javascript,html,bootstrap-modal,Javascript,Html,Bootstrap Modal,我试图在我的地图前面显示一个模式窗口,但它不起作用(我猜它发生在基本地图后面)。如果我移除贴图容器和tilelayer,它会工作得很好。我不知所措。这是一个简单的订购问题还是更复杂的问题(我过去曾遇到过与传单的兼容性问题) HTML JAVASCRIPT // Get the modal var modal = document.getElementById("myModal"); // Get the button that opens the m
// Get the modal
var modal = document.getElementById("myModal");
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
};
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
};
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
};
var maCarte = L.map('carte', { zoomControl: false });
new L.Control.Zoom ({ position: 'bottomleft' }).addTo(maCarte);
maCarte.setView([45.5288,-73.631884], 15);
var fondDeCarte = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'}
);
maCarte.addLayer(fondDeCarte);
//获取模式
var modal=document.getElementById(“myModal”);
//获取打开模式对话框的按钮
var btn=document.getElementById(“myBtn”);
//获取关闭模态的元素
var span=document.getElementsByClassName(“关闭”)[0];
//当用户单击该按钮时,打开模式对话框
btn.onclick=函数(){
modal.style.display=“块”;
};
//当用户单击(x)时,关闭模式对话框
span.onclick=函数(){
modal.style.display=“无”;
};
//当用户单击模式之外的任何位置时,将其关闭
window.onclick=函数(事件){
如果(event.target==模态){
modal.style.display=“无”;
}
};
var maCarte=L.map('carte',{zoomControl:false});
新的L.Control.Zoom({position:'bottomleft'});
maCarte.setView([45.5288,-73.631884],15);
var fondDeCarte=L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{属性:'©;贡献者'}
);
maCarte.addLayer(fondDeCarte);
html,body{
height:100%;
margin:0
}
#carte {
width: 100%;
height: 100%
}
.title{
color: white;
font-family:Impact, Charcoal, sans-serif;
}
.modal {
display: none; /* Hidden by default */
position: fixed; /* Stay in place */
z-index: 1; /* Sit on top */
padding-top: 100px; /* Location of the box */
left: 0;
top: 0;
width: 100%; /* Full width */
height: 100%; /* Full height */
overflow: auto; /* Enable scroll if needed */
background-color: rgb(0,0,0); /* Fallback color */
background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
}
/* Modal Content */
.modal-content {
background-color: #fefefe;
margin: auto;
padding: 20px;
border: 1px solid #888;
width: 80%;
}
/* The Close Button */
.close {
color: #aaaaaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
}
// Get the modal
var modal = document.getElementById("myModal");
// Get the button that opens the modal
var btn = document.getElementById("myBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
};
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
};
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
};
var maCarte = L.map('carte', { zoomControl: false });
new L.Control.Zoom ({ position: 'bottomleft' }).addTo(maCarte);
maCarte.setView([45.5288,-73.631884], 15);
var fondDeCarte = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'}
);
maCarte.addLayer(fondDeCarte);