Not sure how I have managed this but my leaflet zoom controls are not clickable? They do show up on the screen but there is no mouse change when hovering over them.
Do I need to create another layer for the controls or am I missing something else from my code?
update: The map will also not scroll or zoom in – it appears static
This is my script relating to the map:
JavaScript
x
14
14
1
var mymap = L.map('mapid');
2
3
4
var Jawg_Streets = L.tileLayer('https://{s}.tile.jawg.io/jawg-streets/{z}/{x}/{y}{r}.png?access-token={accessToken}', {
5
attribution: '<a href="http://jawg.io" title="Tiles Courtesy of Jawg Maps" target="_blank">© <b>Jawg</b>Maps</a> © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
6
minZoom: 0,
7
maxZoom: 22,
8
subdomains: 'abcd',
9
accessToken: foo
10
}).addTo(mymap);
11
12
mymap.zoomControl.setPosition('bottomleft');
13
mymap.setView([51.505, -0.09], 13);
14
Also not sure if it might relate to my html:
JavaScript
1
50
50
1
<!DOCTYPE html>
2
3
<html lang="en">
4
5
<head>
6
7
<meta charset="utf-8">
8
9
<title>Gazetteer</title>
10
11
12
<meta name="viewport" content="width=device-width, initial-scale=1">
13
14
<link href="favicon.ico" rel="icon">
15
16
<!--Stylesheets-->
17
18
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
19
<link href="css/styles.css" type="text/css" rel="stylesheet">
20
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
21
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
22
crossorigin=""/>
23
<link href='https://api.mapbox.com/mapbox.js/plugins/leaflet-markercluster/v1.0.0/MarkerCluster.css' rel='stylesheet' />
24
<link href='https://api.mapbox.com/mapbox.js/plugins/leaflet-markercluster/v1.0.0/MarkerCluster.Default.css' rel='stylesheet' />
25
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.css">
26
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.3/css/fontawesome.min.css" integrity="sha384-wESLQ85D6gbsF459vf1CiZ2+rr+CsxRY0RpiF1tLlQpDnAgg6rwdsUF1+Ics2bni" crossorigin="anonymous">
27
<script src="https://use.fontawesome.com/acad2da5ff.js"></script>
28
</head>
29
30
<body>
31
<div id="mapid" class="container-fluid">
32
33
</div>
34
35
etc
36
37
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
38
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
39
crossorigin=""></script>
40
<script src="https://cdn.jsdelivr.net/npm/leaflet-easybutton@2/src/easy-button.js"></script>
41
<script src="https://api.tiles.mapbox.com/mapbox.js/plugins/leaflet-markercluster/v1.0.0/leaflet.markercluster.js"></script>
42
<script type="application/javascript" src="js/jquery-2.2.3.min.js"></script>
43
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-Piv4xVNRyMGpqkS2by6br4gNJ7DXjqk09RmUpJ8jgGtD7zP9yug3goQfGII0yAns" crossorigin="anonymous"></script>
44
<script type="application/javascript" src="js/script.js"></script>
45
46
47
</body>
48
49
</html>
50
Or CSS
JavaScript
1
5
1
#mapid {
2
height: 100vh;
3
z-index: -1;
4
}
5
Thanks
Advertisement
Answer
Remove the z-index: -1
from the css styling and it should work.