<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Simple map</title>
<link
rel="stylesheet"
href="https://unpkg.com/leaflet@1.9.2/dist/leaflet.css"
/>
<script src="https://unpkg.com/leaflet@1.9.2/dist/leaflet.js"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="map"></div>
<script src="script.js"></script>
</body>
</html>
/* eslint-disable no-undef */
/**
* Simple map
*/
// config map
let config = {
minZoom: 7,
maxZoom: 18,
};
// magnification with which the map will start
const zoom = 18;
// co-ordinates
const lat = 52.22977;
const lng = 21.01178;
// calling map
const map = L.map("map", config).setView([lat, lng], zoom);
// Used to load and display tile layers on the map
// Most tile servers require attribution, which you can set under `Layer`
L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
attribution:
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
}).addTo(map);
*,
:after,
:before {
box-sizing: border-box;
padding: 0;
margin: 0;
}
html {
height: 100%;
}
body,
html,
#map {
width: 100%;
height: 100%;
}
body {
position: relative;
min-height: 100%;
margin: 0;
padding: 0;
background-color: #f1f1f1;
}
{source}<?php
$doc->addStyleSheet( 'https://unpkg.com/leaflet@1.9.2/dist/leaflet.css' );
?>
{/source}
{source}<?php
$doc->addScript( 'https://unpkg.com/leaflet@1.9.2/dist/leaflet.js' );
?>{/source}
{source}<?php
$doc->addStyleSheet( JURI::root( true ).'style.css' );
?>
{/source}
{source}
<div id="map"></div>
<script src="script.js"></script>
{/source}
{source}
<?php
$doc->addStyleSheet( 'https://unpkg.com/leaflet@1.9.2/dist/leaflet.css' );
$doc->addScript( 'https://unpkg.com/leaflet@1.9.2/dist/leaflet.js' );
$doc->addStyleSheet( JURI::root( true ).'/path/to/your/style.css' );
?>
<div id="map"></div>
<script src="<?php echo JURI::root( true ).'/path/to/your/script.js'; ?>"></script>
{/source}