title: How to limit map bounds on toggle button "world view" and "country view"
body: <p>Im trying to make a map with a button to toggle &quot;world view&quot; or a specific &quot;country view&quot;</p>
  <p>I tried to use this <a href="https://docs.mapbox.com/mapbox-gl-js/example/restrict-bounds/" rel="nofollow noreferrer">example</a>, which is limiting view to bounds. But this solution does not let me toggle between bbox-country and bbox-worldview after the map has initialized.</p>
  <p>How do i change the maxBounds after map init load?</p>
  <pre><code>var bounds = [
  [-74.04728500751165, 40.68392799015035], // Southwest coordinates
  [-73.91058699000139, 40.87764500765852] // Northeast coordinates
  ];
   
  var map = new mapboxgl.Map({
  container: 'map',
  style: 'mapbox://styles/mapbox/streets-v11',
  center: [-73.9978, 40.7209],
  zoom: 13,
  maxBounds: bounds // Need maxBounds to be changable after init
  });
  </code></pre>
  <p>Any help appreciated :)</p>