I need to add an interactive sidebar to my map.
Im using this as an example to add the sidebar: https://www.w3schools.com/w3css/w3css_sidebar.asp
Ive tried using the sidebar codes provided but it doesnt seem to add anything to the map. I need a sidebar overlay which is the same height and width as the map. Is there any way possible that a sidebar can be added? If anyone has a solution do let me know or you can write the code down as well.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css"
integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ=="
crossorigin=""/>
<!-- Make sure you put this AFTER Leaflet's CSS -->
<script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js"
integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
crossorigin=""></script>
<style>
body {
margin: 0;
padding: 0;
}
#map {
position: absolute;
height: 100%;
width: 100%;
background-color: rgb(38, 38, 38);
}
</style>
<title>Map Testing</title>
</head>
<body>
<h2>Leaflet JS</h2>
<div id="map"></div>
<script src="myscripts.js"></script>
</body>
</html>
If you use the example from you, you have to add in the css a high z-index (over 1000), else it is showing below the map and you don't see the sidebar.
I use this sidebar, look into it: https://github.com/Turbo87/sidebar-v2
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.