Hide Table of Contents
View Resizable map sample in sandbox
Resizable map

Description

This sample demonstrates how to use the dojox.layout.ResizeHandle widget to display a resizable map. When you run this sample notice that the bottom right corner of the map contains a resize image. Click and drag the image to resize the map.

Code

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
    <title>Resizable Map</title>
    
    <link rel="stylesheet" href="https://js.arcgis.com/3.46/dijit/themes/claro/claro.css">
    
    <link rel="stylesheet" href="https://js.arcgis.com/3.46/dojox/layout/resources/ResizeHandle.css">
    <link rel="stylesheet" href="https://js.arcgis.com/3.46/esri/css/esri.css">
    
    <style>
      /* Adjust the position of map resize handle a little bit */
     .dojoxResizeHandle {
        right: 0px;
        bottom: 0px;
      }
    </style>
    
    <script>
      var dojoConfig = {
        //Required if you have dojo widgets(aka.dijits) in your HTML 
        parseOnLoad: true
      };
    </script>
    <script src="https://js.arcgis.com/3.46/"></script>
    <script>
    //Required if you have dojo widgets (aka. dijits)in your HTML markup 
    dojo.require("dojo.parser"); 

    // Import ResizeHandle module 
    dojo.require("dojox.layout.ResizeHandle");

    dojo.ready(pageReady);

    var map; 

    function pageReady() {
      map = new esri.Map("mapDiv", { 
        basemap: "gray-vector",
        center: [2.352, 48.87],
        zoom: 6
      });
    }
    </script>
  </head>

  <body class="claro">
    
    <div id="mapDiv" style="position: relative; width: 400px; height: 400px; border:2px solid #575757;">
      
      <div data-dojo-type="dojox.layout.ResizeHandle" 
           data-dojo-props="targetId:'mapDiv',activeResize:true,intermediateChanges:true">
        <script type="dojo/method" event="onResize">
          if (window.map) {
            window.map.resize();
          }
        </script>
      </div>
    </div>
  </body>
</html>
 
          
Show Modal