mapgl-invalidate-size

by Trufi

HTML

<script src="https://mapgl.2gis.com/api/js/v1"></script>
<div id="container"></div>

CSS

#container{
  width: 300px;
  height: 500px;
}

JavaScript

// API key can be used on jsfiddle.net only!
// You can get more info on https://docs.2gis.com/

const map = new mapgl.Map('container', {
  center: [55.27052, 25.22522],
  zoom: 11,
  key: 'bfd8bbca-8abf-11ea-b033-5fa57aae2de7',
});

const container = document.getElementById('container');

let width = 300;

setInterval(() => {
  width += 1;
  container.style.width = width % 800 + 'px';
  map.invalidateSize();
}, 0);