Skip to content

Add a fullscreen control

Add a fullscreen control to the map.

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset='utf-8'>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel='stylesheet' href="https://cdn.yellowmap.de/autocomplete/autocomplete-5.0.10.min.css" />
        <script src="https://cdn.smartmaps.cloud/packages/smartmaps/smartmaps-gl/v2/umd/smartmaps-gl.min.js"></script>
        <style>
            body { 
                margin: 0; padding: 0; 
            }
            html, 
            body, 

            #map { 
                height: 100%; 
            }
        </style>
    </head>
    <body>
        <div id="map"></div>
        <script>
            const map = new smartmapsgl.Map({
                apiKey: "INSERT API-KEY",
                container: "map",
                center: [11.39085, 47.27574],
                zoom: 2,
                style: smartmapsgl.MapStyle.AUTO
            });

            map.addControl(
                new smartmapsgl.FullscreenControl()
            );
        </script>
    </body>
</html>