Dynamic Size

<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Campzimmer | Dynamic Size</title>
    <link href="https://cdn.campzimmer.com/campzimmer.css" rel="stylesheet">
    <script src="https://cdn.campzimmer.com/campzimmer.js"></script>
    <style>
      #viewer{
        width: 100%;
        height: 50vh;
        position: relative;
      }
    </style>
  </head>
  <body>
    <div id="viewer"></div>
    <script>
      var image = 'https://cdn.campzimmer.com/testimages/8.jpg';
      var instance = new Campzimmer.Campzimmer({
        container: 'viewer',
        image : image,
        caption: 'Example on how to update the size on the container'
      });
      var button = document.querySelector('.update-size-button');
      button.addEventListener('click', function(){
        var width = Math.floor(Math.random() * (500 - 400 + 1)) + 400;
        var height = Math.floor(Math.random() * (400 - 300 + 1)) + 300;
        instance.setSize({width: width+'px', height: height+'px'})
      });
    </script>
  </body>
</html>