Hello list,<br><br>I've had a couple of requests about how we made the map resize automatically with a window resize in our applications<br>see <a href="http://nlwis-snite1.agr.gc.ca/eco/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://nlwis-snite1.agr.gc.ca/eco/
</a> for an example application.<br><br>I agree it could be written a bit better - but I don't have a lot of time for doing that before posting, so instead I will pass off what I hope is all the files I affected for this functionality. I've included a template file with css and js files that create a wireframe of the application with only MapDHTML and CompassPoint Widgets. I've also included the snippits from the
cwcjsapi.js and UpdateMap.php that I added. The snippit in cwcjsapi is a function, so it's no important where exactly it goes in the file. the snippit in UpdateMap should happen just before the $oMapSession->saveState() line (~ 750 something).
<br><br>The positioning of these elements is done first with CSS and then the resizing is done with JavaScript. The positioning is relative to adjacent components, so leaving the wireframe in helps to see how that is done.
<br><br>Really the javascript should be with the widget and not separate like I have it. I started out having it separate and havn't had a chance to move it in. When something works, it's hard to start breaking it ;-)
<br><br>Feel free to run with the code - if you make improvements, I wouldn't mind hearing about them. Also, please don't hesitate to post folllow up questions. I did this assembling in haste and i might have missed something or not it explained it well enough.
<br><br>Cheers,<br><br>Liz Godwin<br>