layout: function () { //Not executed if map is not created yet if (this.mapobj) { this.onMapResize(); } }, onMapResize: function () { if (dojo.coords(this.domNode).w > 2 && dojo.coords(this.domNode).h > 2) { window.clearTimeout(this.resizetimer); this.resizetimer = window.setTimeout(dojo.hitch(this, function () { this.mapobj.resize(); this.mapobj.reposition(); }), 200); } return arguments; }
<body class="tundra" onresize="onPageResizeHandler()"> <form id="form1"> <div id="header"> </div> <div id="leftcolumn" dojotype="dijit.layout.ContentPane"> </div> <div id="center" dojotype="dijit.layout.ContentPane"> <div id="map" style="width:1200px; height:600px; border:1px solid #000;"></div> </div> </form> </body>
function onPageResizeHandler() { var _header = dojo.marginBox(dojo.byId("header")); var _leftcolumn = dojo.marginBox(dojo.byId("leftcolumn")); var windowsize = getWindowSize(); _height = windowsize.h - _header.h; _width = windowsize.w - _leftcolumn.w; var centerbox = dojo.marginBox(dojo.byId("center"), { h: _height, w: _width }); var leftcolumnbox = dojo.marginBox(dojo.byId("leftcolumn"), { h: _height }); var centerbox2 = dojo.marginBox(dojo.byId("center")); centerbox2.l = 0; centerbox2.t = 0; dojo.publish("ResizeMap", [centerbox2]); };
var mapDiv = dojo.byId(this.map.id); dojo.style(mapDiv, { left: contentBox.l + "px", top: contentBox.t + "px", width: contentBox.w + "px", height: contentBox.h + "px" }); this.map.resize(); this.map.reposition();
var resizeTimer; dojo.connect(map, 'onLoad', function(theMap) { dojo.connect(dijit.byId('map'), 'resize', function() { //resize the map if the div is resized clearTimeout(resizeTimer); resizeTimer = setTimeout( function() { map.resize(); map.reposition(); }, 500); }); }); }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.