code Snippetlanguage CDNpackage_2 NPM
content_copy Copyopen_in_new Open
const stores = [
{ name: 'Store Marais' , address: '15 Rue des Francs Bourgeois' , lat: 48.8571 , lng: 2.3621 },
{ name: 'Store Louvre' , address: '2 Rue de Rivoli' , lat: 48.8606 , lng: 2.3376 },
{ name: 'Store Montmartre' , address: '30 Rue Lepic' , lat: 48.8847 , lng: 2.3334 },
{ name: 'Store Latin Quarter' , address: '10 Rue Mouffetard' , lat: 48.8430 , lng: 2.3499 },
{ name: 'Store Bastille' , address: '5 Rue de la Roquette' , lat: 48.8534 , lng: 2.3715 }
];
const map = L . map ( 'map' ). setView ([ 48.8600 , 2.3500 ], 13 );
L . tileLayer ( 'https://api.maptiler.com/maps/streets-v4/256/{z}/{x}/{y}.png?key=YOUR_MAPTILER_KEY' , {
tileSize: 256 ,
attribution: '© <a href="https://www.maptiler.com/">MapTiler</a> © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}). addTo (map);
const panel = document. getElementById ( 'store-panel' );
stores. forEach ( s => {
const marker = L . marker ([s.lat, s.lng]). addTo (map). bindPopup ( `<strong>${ s . name }</strong><br>${ s . address }` );
const item = document. createElement ( 'div' );
item.className = 'store-item' ;
item.innerHTML = `<strong>${ s . name }</strong>${ s . address }` ;
item. addEventListener ( 'click' , () => { map. setView ([s.lat, s.lng], 16 ); marker. openPopup (); });
panel. appendChild (item);
}); content_copy Copyopen_in_new Open
<! DOCTYPE html >
< html >
< head >
< meta charset = "utf-8" />
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" />
< link rel = "stylesheet" href = "https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
< script src = "https://unpkg.com/leaflet@1.9.4/dist/leaflet.js" ></ script >
< style >
body { margin : 0 ; padding : 0 ; }
#map { width : 100 % ; height : 100 vh ; }
#store-panel { position : absolute ; top : 0 ; left : 0 ; width : 280 px ; height : 100 % ; background : #141414 ; border-right : 2 px solid #2a2a2a ; z-index : 1000 ; overflow-y : auto ; padding : 0 ; }
#store-panel h3 { color : #e0e0e0 ; font-family : monospace ; padding : 12 px ; margin : 0 ; border-bottom : 2 px solid #2a2a2a ; }
.store-item { padding : 10 px 12 px ; border-bottom : 1 px solid #2a2a2a ; cursor : pointer ; color : #ccc ; font-size : 13 px ; }
.store-item:hover { background : #1e1e1e ; }
.store-item strong { color : #4CAF50 ; display : block ; margin-bottom : 2 px ; }
#map { margin-left : 280 px ; }
</ style >
</ head >
< body >
< div id = "map" ></ div >
< div id = "store-panel" >< h3 >Stores in Paris</ h3 ></ div >
< script >
const stores = [
{ name: 'Store Marais' , address: '15 Rue des Francs Bourgeois' , lat: 48.8571 , lng: 2.3621 },
{ name: 'Store Louvre' , address: '2 Rue de Rivoli' , lat: 48.8606 , lng: 2.3376 },
{ name: 'Store Montmartre' , address: '30 Rue Lepic' , lat: 48.8847 , lng: 2.3334 },
{ name: 'Store Latin Quarter' , address: '10 Rue Mouffetard' , lat: 48.8430 , lng: 2.3499 },
{ name: 'Store Bastille' , address: '5 Rue de la Roquette' , lat: 48.8534 , lng: 2.3715 }
];
const map = L . map ( 'map' ). setView ([ 48.8600 , 2.3500 ], 13 );
L . tileLayer ( 'https://api.maptiler.com/maps/streets-v4/256/{z}/{x}/{y}.png?key=YOUR_MAPTILER_KEY' , {
tileSize: 256 ,
attribution: '© <a href="https://www.maptiler.com/">MapTiler</a> © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}). addTo (map);
const panel = document. getElementById ( 'store-panel' );
stores. forEach ( s => {
const marker = L . marker ([s.lat, s.lng]). addTo (map). bindPopup ( `<strong>${ s . name }</strong><br>${ s . address }` );
const item = document. createElement ( 'div' );
item.className = 'store-item' ;
item.innerHTML = `<strong>${ s . name }</strong>${ s . address }` ;
item. addEventListener ( 'click' , () => { map. setView ([s.lat, s.lng], 16 ); marker. openPopup (); });
panel. appendChild (item);
});
</ script >
</ body >
</ html > content_copy Copyopen_in_new Open
import L from 'leaflet' ;
import 'leaflet/dist/leaflet.css' ;
const stores = [
{ name: 'Store Marais' , address: '15 Rue des Francs Bourgeois' , lat: 48.8571 , lng: 2.3621 },
{ name: 'Store Louvre' , address: '2 Rue de Rivoli' , lat: 48.8606 , lng: 2.3376 },
{ name: 'Store Montmartre' , address: '30 Rue Lepic' , lat: 48.8847 , lng: 2.3334 },
{ name: 'Store Latin Quarter' , address: '10 Rue Mouffetard' , lat: 48.8430 , lng: 2.3499 },
{ name: 'Store Bastille' , address: '5 Rue de la Roquette' , lat: 48.8534 , lng: 2.3715 }
];
const map = L . map ( 'map' ). setView ([ 48.8600 , 2.3500 ], 13 );
L . tileLayer ( 'https://api.maptiler.com/maps/streets-v4/256/{z}/{x}/{y}.png?key=YOUR_MAPTILER_KEY' , {
tileSize: 256 ,
attribution: '© <a href="https://www.maptiler.com/">MapTiler</a> © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}). addTo (map);
const panel = document. getElementById ( 'store-panel' );
stores. forEach ( s => {
const marker = L . marker ([s.lat, s.lng]). addTo (map). bindPopup ( `<strong>${ s . name }</strong><br>${ s . address }` );
const item = document. createElement ( 'div' );
item.className = 'store-item' ;
item.innerHTML = `<strong>${ s . name }</strong>${ s . address }` ;
item. addEventListener ( 'click' , () => { map. setView ([s.lat, s.lng], 16 ); marker. openPopup (); });
panel. appendChild (item);
});
const stores = [
{ name: 'Store Marais', address: '15 Rue des Francs Bourgeois', lat: 48.8571, lng: 2.3621 },
{ name: 'Store Louvre', address: '2 Rue de Rivoli', lat: 48.8606, lng: 2.3376 },
{ name: 'Store Montmartre', address: '30 Rue Lepic', lat: 48.8847, lng: 2.3334 },
{ name: 'Store Latin Quarter', address: '10 Rue Mouffetard', lat: 48.8430, lng: 2.3499 },
{ name: 'Store Bastille', address: '5 Rue de la Roquette', lat: 48.8534, lng: 2.3715 }
];
const map = L.map('map').setView([48.8600, 2.3500], 13);
L.tileLayer('https://api.maptiler.com/maps/streets-v4/256/{z}/{x}/{y}.png?key=YOUR_MAPTILER_KEY', {
tileSize: 256,
attribution: '© <a href="https://www.maptiler.com/">MapTiler</a> © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}).addTo(map);
const panel = document.getElementById('store-panel');
stores.forEach(s => {
const marker = L.marker([s.lat, s.lng]).addTo(map).bindPopup(`<strong>${s.name}</strong><br>${s.address}`);
const item = document.createElement('div');
item.className = 'store-item';
item.innerHTML = `<strong>${s.name}</strong>${s.address}`;
item.addEventListener('click', () => { map.setView([s.lat, s.lng], 16); marker.openPopup(); });
panel.appendChild(item);
}); <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<style>
body { margin: 0; padding: 0; }
#map { width: 100%; height: 100vh; }
#store-panel { position: absolute; top: 0; left: 0; width: 280px; height: 100%; background: #141414; border-right: 2px solid #2a2a2a; z-index: 1000; overflow-y: auto; padding: 0; }
#store-panel h3 { color: #e0e0e0; font-family: monospace; padding: 12px; margin: 0; border-bottom: 2px solid #2a2a2a; }
.store-item { padding: 10px 12px; border-bottom: 1px solid #2a2a2a; cursor: pointer; color: #ccc; font-size: 13px; }
.store-item:hover { background: #1e1e1e; }
.store-item strong { color: #4CAF50; display: block; margin-bottom: 2px; }
#map { margin-left: 280px; }
</style>
</head>
<body>
<div id="map"></div>
<div id="store-panel"><h3>Stores in Paris</h3></div>
<script>
const stores = [
{ name: 'Store Marais', address: '15 Rue des Francs Bourgeois', lat: 48.8571, lng: 2.3621 },
{ name: 'Store Louvre', address: '2 Rue de Rivoli', lat: 48.8606, lng: 2.3376 },
{ name: 'Store Montmartre', address: '30 Rue Lepic', lat: 48.8847, lng: 2.3334 },
{ name: 'Store Latin Quarter', address: '10 Rue Mouffetard', lat: 48.8430, lng: 2.3499 },
{ name: 'Store Bastille', address: '5 Rue de la Roquette', lat: 48.8534, lng: 2.3715 }
];
const map = L.map('map').setView([48.8600, 2.3500], 13);
L.tileLayer('https://api.maptiler.com/maps/streets-v4/256/{z}/{x}/{y}.png?key=YOUR_MAPTILER_KEY', {
tileSize: 256,
attribution: '© <a href="https://www.maptiler.com/">MapTiler</a> © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}).addTo(map);
const panel = document.getElementById('store-panel');
stores.forEach(s => {
const marker = L.marker([s.lat, s.lng]).addTo(map).bindPopup(`<strong>${s.name}</strong><br>${s.address}`);
const item = document.createElement('div');
item.className = 'store-item';
item.innerHTML = `<strong>${s.name}</strong>${s.address}`;
item.addEventListener('click', () => { map.setView([s.lat, s.lng], 16); marker.openPopup(); });
panel.appendChild(item);
});
</script>
</body>
</html> import L from 'leaflet';
import 'leaflet/dist/leaflet.css';
const stores = [
{ name: 'Store Marais', address: '15 Rue des Francs Bourgeois', lat: 48.8571, lng: 2.3621 },
{ name: 'Store Louvre', address: '2 Rue de Rivoli', lat: 48.8606, lng: 2.3376 },
{ name: 'Store Montmartre', address: '30 Rue Lepic', lat: 48.8847, lng: 2.3334 },
{ name: 'Store Latin Quarter', address: '10 Rue Mouffetard', lat: 48.8430, lng: 2.3499 },
{ name: 'Store Bastille', address: '5 Rue de la Roquette', lat: 48.8534, lng: 2.3715 }
];
const map = L.map('map').setView([48.8600, 2.3500], 13);
L.tileLayer('https://api.maptiler.com/maps/streets-v4/256/{z}/{x}/{y}.png?key=YOUR_MAPTILER_KEY', {
tileSize: 256,
attribution: '© <a href="https://www.maptiler.com/">MapTiler</a> © <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'
}).addTo(map);
const panel = document.getElementById('store-panel');
stores.forEach(s => {
const marker = L.marker([s.lat, s.lng]).addTo(map).bindPopup(`<strong>${s.name}</strong><br>${s.address}`);
const item = document.createElement('div');
item.className = 'store-item';
item.innerHTML = `<strong>${s.name}</strong>${s.address}`;
item.addEventListener('click', () => { map.setView([s.lat, s.lng], 16); marker.openPopup(); });
panel.appendChild(item);
});