如何在傳單地圖上覆蓋div
而不是點擊通過?我設置 我試圖pointer-events: none
和auto
,在覆蓋div,但沒有幫助。設置pointer-events
到none
了該radiobutton
無法點擊了效果......在傳單上覆蓋div無法點擊通過
// We’ll add a tile layer to add to our map, in this case it’s a OSM tile layer.
// Creating a tile layer usually involves setting the URL template for the tile images
var osmUrl = 'http://{s}.tile.osm.org/{z}/{x}/{y}.png',
osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
osm = L.tileLayer(osmUrl, {
maxZoom: 18,
attribution: osmAttrib
});
// initialize the map on the "map" div with a given center and zoom
var map = L.map('map').setView([19.04469, 72.9258], 12).addLayer(osm);
// Script for adding marker on map click
function onMapClick(e) {
var marker = L.marker(e.latlng, {
draggable: true,
title: "Resource location",
alt: "Resource Location",
riseOnHover: true
}).addTo(map)
.bindPopup(e.latlng.toString()).openPopup();
// Update marker on changing it's position
marker.on("dragend", function(ev) {
var chagedPos = ev.target.getLatLng();
this.bindPopup(chagedPos.toString()).openPopup();
});
}
map.on('click', onMapClick);
#map {
height: 500px;
width: 80%;
z-index: 1;
position: relative;
}
.overlay {
height: 500px;
width: 100px;
position: absolute;
right: 0px;
z-index: 2;
background-color: rgba(255, 50, 50, 0.5);
pointer-events: auto;
}
<script src="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.js"></script>
<link href="http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css" rel="stylesheet" />
<div id="map">
<div class = "overlay">
<input type="radio" class = "someButton">Foo Bar
</div>
</div>
你改變了哪部分修復了它?刪除指針事件,z-index或其他東西? –
重要的是,覆蓋div不在地圖div內。 –
甚至沒有注意到這種變化。謝謝 –