-
Notifications
You must be signed in to change notification settings - Fork 0
/
counties.html
202 lines (189 loc) · 5.93 KB
/
counties.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Map of Oakley</title>
<!-- Include Leaflet.js directly in the HTML -->
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
<style>
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
display: flex;
overflow: hidden;
}
#map {
flex: 1;
height: 100vh;
}
.custom-sidebar {
position: fixed;
right: -400px;
/* Start off-screen */
top: 0;
height: 100%;
width: 300px;
background: #fff;
padding: 20px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
transition: right 0.5s ease-out;
z-index: 1000;
}
.custom-sidebar img {
max-width: 100%;
height: auto;
}
/* Normal state styles */
.nameloc {
text-decoration: none;
color: black;
display: inline-block;
overflow: hidden;
transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}
/* Hover state styles */
.nameloc:hover {
color: blue;
transform: scaleX(1.05); scaleY(1.05); /* Adjust the scale factor as needed */
}
</style>
</head>
<body>
<div id="map"></div>
<!-- Example custom sidebars -->
<div id="sidebar1" class="custom-sidebar" style="background-color: white; z-index: 1001; border: black 2px solid;">
<div style="display: flex;">
<div style="width: 40%;">
<div style="border: black 2px solid;">
<img src="https://blizztube.github.io/Oakley-FSA/lecar.ico" alt="lecar" style="width: 100%; height: auto; display: block; margin: 0;">
</div>
</div>
<div style="width: 60%; text-align: right;">
<a href="link.com" class="nameloc"><h2>Oakley</h2></a>
<p>Population: 1,200,000</p>
</div>
</div>
</div>
<div id="sidebar2" class="custom-sidebar" style="background-color: white; z-index: 1002; border: black 2px solid;">
<div style="display: flex;">
<div style="width: 40%;">
<div style="border: black 2px solid;">
<img src="https://blizztube.github.io/Oakley-FSA/lecar.ico" alt="lecar" style="width: 100%; height: auto; display: block; margin: 0;">
</div>
</div>
<div style="width: 60%; text-align: right;">
<a href="link.com" class="nameloc"><h2>Acres Township</h2></a>
<p>Population: 78</p>
<p>Area: 3.8 sq mi</p>
<p>Density: 20 sq mi</p>
</div>
</div>
</div>
<!-- End of custom sidebars -->
<script>
var mymap = L.map('map').setView([-41.4829,160.8701], 9);
L.tileLayer('https://tile.opengeofiction.net/ogf-carto/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
}).addTo(mymap);
// Associate each multipolygon with a specific sidebar
var multipolygons = [{
coordinates: [
[-41.70484, 159.9854],
[-41.70556, 160.59416],
[-41.66886, 160.62313],
[-41.58500, 160.65163],
[-41.53272, 160.64042],
[-41.51279, 160.6703],
[-41.45874, 160.68553],
[-41.43811, 160.70426],
[-41.40667, 160.7648],
[-41.41651, 160.76094],
[-41.42092, 160.77451],
[-41.41851, 160.78547],
[-41.42972, 160.79373],
[-41.42271, 160.80108],
[-41.43001, 160.80937],
[-41.43028, 160.82203],
[-41.43915, 160.84036],
[-41.45088, 160.85463],
[-41.4399, 160.8945],
[-41.3836, 160.9841],
[-41.24856, 161.04358],
[-40.80767, 160.61716],
[-40.69363, 160.36872],
[-40.90906, 160.19911],
[-40.9133, 160.1522],
[-40.9498, 160.1043],
[-40.97714, 160.1191],
[-40.98322, 160.11230],
[-40.99138, 160.11349],
[-40.99372, 160.08919],
[-41.01513, 160.06798],
[-41.04641, 160.11528],
[-41.07134, 160.16752],
[-41.07796, 160.12367],
[-41.09657, 160.1066],
[-41.09430, 160.03754],
[-41.09490, 160.03674],
[-41.1119, 160.0734],
[-41.1489, 160.0189],
[-41.14370, 159.96317],
[-41.2543, 159.946],
[-41.28313, 159.93329],
[-41.3068, 159.9544],
[-41.38820, 159.96054],
[-41.39050, 160.00287],
[-41.43832, 160.02091],
[-41.47662, 159.97874],
[-41.51760, 159.99460],
[-41.5898, 159.9394],
[-41.6221, 159.9002],
[-41.6334, 159.9211],
[-41.65257, 159.93037],
[-41.65272, 159.98524],
[-41.70484, 159.9854]
],
sidebarId: 'sidebar1'
},
{
coordinates: [
[-41.30582,159.95298],
[-41.38785,159.96056],
[-41.38984,160.00228],
[-41.38661,160.0019],
[-41.38402,159.97066],
[-41.38402,159.97066],
[-41.38402,159.97066],
[-41.30582,159.95298]
],
sidebarId: 'sidebar2'
}
// Add more multipolygons as needed
];
multipolygons.forEach(function(multipolygonData) {
var multipolygon = L.polygon([multipolygonData.coordinates], {
color: 'black',
fillColor: 'blue',
fillOpacity: 0.2
}).addTo(mymap);
multipolygon.on('click', function(event) {
openCustomSidebar(multipolygonData.sidebarId);
});
});
function openCustomSidebar(sidebarId) {
// Close all custom sidebars
document.querySelectorAll('.custom-sidebar').forEach(function(sidebar) {
sidebar.style.right = '-400px';
});
// Open the selected custom sidebar
var selectedSidebar = document.getElementById(sidebarId);
if (selectedSidebar) {
selectedSidebar.style.right = '0';
}
}
</script>
</body>
</html>