huhao.esri

How auto-resize works in 3.3??

Discussion created by huhao.esri on Feb 4, 2013
Latest reply on Feb 8, 2013 by jacobsj
I noticed that the maps in 3.3 can auto-resizes, but I'm not sure how it works. I want to make sure the the map is resized when user change size of the browser. Here is my test code, I set the autoResize attribute but it doesn't work. Anyone can help? Thanks!


<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>Simple Map</title>
    <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/claro/claro.css">
    <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css">
    <style>
      html, body, #map {
        height:100%;
        width:100%;
        margin:0;
        padding:0;
      }
      body {
        background-color:#FFF;
        overflow:hidden;
        font-family:"Trebuchet MS";
      }
    </style>
    <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/"></script>
    <script>
        dojo.require("esri.map");
        var map;
        function init() {
            map = new esri.Map("map", {
                autoResize: true
            });

            var dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer");
            map.addLayer(dynamicMapServiceLayer);
        }
        dojo.ready(init);

    </script>
  </head>

  <body class="claro">
    <div id="map"></div>
  </body>
</html> 

Outcomes