Skip to content

Cooperative gestures

Enable cooperative gestures. See how it behaves in fullscreen mode.

const map = new maplibregl.Map({
    container: 'map',
    style: 'https://demotiles.maplibre.org/style.json',
    center: [-74.5, 40],
    cooperativeGestures: true,
    zoom: 4
});
map.addControl(new maplibregl.FullscreenControl());
<!DOCTYPE html>
<html lang="en">
<head>
    <title>Cooperative gestures</title>
    <meta property="og:description" content="Enable cooperative gestures. See how it behaves in fullscreen mode." />
    <meta property="og:created" content="2023-11-22" />
    <meta charset='utf-8'>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel='stylesheet' href='https://unpkg.com/maplibre-gl@5.24.0/dist/maplibre-gl.css' />
    <script src='https://unpkg.com/maplibre-gl@5.24.0/dist/maplibre-gl.js'></script>
    <style>
        body { margin: 0; padding: 0; }
        html, body, #map { height: 100%; }
    </style>
</head>
<body>
<div id="map"></div>

<script>
    const map = new maplibregl.Map({
        container: 'map',
        style: 'https://demotiles.maplibre.org/style.json',
        center: [-74.5, 40],
        cooperativeGestures: true,
        zoom: 4
    });
    map.addControl(new maplibregl.FullscreenControl());
</script>
</body>
</html>