Skip to content

View a fullscreen map

Toggle between current view and fullscreen mode.

<!DOCTYPE html>
<html lang="en">
    <title>View a fullscreen map</title>
    <meta property="og:description" content="Toggle between current view and fullscreen mode." />
    <meta charset='utf-8'>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel='stylesheet' href='[email protected]/dist/maplibre-gl.css' />
    <script src='[email protected]/dist/maplibre-gl.js'></script>
        body { margin: 0; padding: 0; }
        html, body, #map { height: 100%; }
<div id="map"></div>

    const map = new maplibregl.Map({
        container: 'map', // container id
            '', //stylesheet location
        center: [11.255, 43.77], // starting position
        zoom: 13 // starting zoom

    map.addControl(new maplibregl.FullscreenControl());