[OSM-dev] CSS gurus required

Christopher Schmidt crschmidt at metacarta.com
Thu Nov 23 14:58:34 GMT 2006


On Thu, Nov 23, 2006 at 12:43:16PM +0000, SteveC wrote:
> Can anyone figure out how to make this resizing work properly?
> 
> http://www.openstreetmap.org/index-new.html
> 
> Eg make it consitantly hug the border of the browser window.

I've not yet found a pure-CSS way to do this in all browsers. In order
to do this, I've used:

function adjustWidth(px,element) {
  if (window.innerWidth) {
    element.style.width=Math.max(window.innerWidth-px,100)+"px";
  } else if (document.documentElement.clientWidth) {
    element.style.width=Math.max(document.documentElement.clientWidth-px,100)+"px";
  } else if (document.body.clientWidth) {
     element.style.width=Math.max(document.body.clientWidth-px,100)+"px";
  }
}

If you run "adjustWidth(200, $('map'))", it should do something close to
what you want.

Regards,
-- 
Christopher Schmidt
MetaCarta




More information about the dev mailing list