[OpenLayers-Dev] OpenLayers doesn't like being pushed aside by Float

Christopher Schmidt crschmidt at metacarta.com
Mon Feb 23 16:07:34 EST 2009


On Tue, Feb 24, 2009 at 09:43:11AM +1300, Craig Stanton wrote:
> Add this line before the map div and you should see what I'm seeing.
> 
>         <div style="width:200px;height:200px;background-color:#666;float:left"></div>
>  
> So the map div has not been modified from what you'd see in the tutorials, it only has width and height defined. It is not positioned at all, just moved aside by another div that is positioned. I guess that's the problem.

Yeah. I can't suggest a solution to this. This problem isn't just with
OpenLayers -- the browser itself behaves differently on the three
different browsers I tried it on, but in all cases, the 'frame' of the
map is not pushed aside by the floated div.

Contrary to my previous email, adding 'position:absolute' to the map div
does actually *Fix* this problem, rathr than causing it, but I'm sure
that has numerous sideeffects: I would suggest that is a potiential
solution to explore.

-- Chris

> ~Craig
> 
> 
> 
> Date: Mon, 23 Feb 2009 15:36:03 -0500
> From: Christopher Schmidt 
> 
> On Tue, Feb 24, 2009 at 09:31:28AM +1300, Craig Stanton wrote:
> > Hi all,
> >     I'm new to OpenLayers but have done a lot of searching to find a
> >     solution to a problem I have come across straight away. What I did
> >     was place a div to the left of the map div, held there by a
> >     style="float:left" command. I then discovered that my
> >     double-clicks on the map are interpreted as if the map is still up
> >     against the left side of the browser window. So if the other div
> >     is 100 wide the map is moved 100 pixels to the right. I then click
> >     on Africa and the map thinks that I've clicked on Australia. 
> >  
> > I've seen some emails in these archives discussing the use of map.updateSize(). I put that into my init function but it changed nothing. I believe the problem is that OpenLayers is not aware that it has been displaced from the side of the window. Has anyone come across this and found a solution?
> 
> Is your map div positioned absolutely? I would not be surprised to find
> that this would be a problem in this case. Otherise, the best thing to
> do is take the smallest possible OpenLayers example:
> 
>   http://openlayers.org/dev/examples/lite.html 
> 
> Modify it as little as possible, and demonstrate the buggy behavior,
> preferably by linking to a live instance of it. Ading
> style='float:right' to that map div did *not* allow me to reproduce the
> effect, so I will need more information to understand the problem.
> 
> Regards,
> -- 
> Christopher Schmidt
> MetaCarta
> 
> 
> ------------------------------
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org 
> http://openlayers.org/mailman/listinfo/dev 
> 
> 
> End of Dev Digest, Vol 29, Issue 27
> ***********************************
> 
> NIWA is the trading name of the National Institute of Water & Atmospheric Research Ltd.

> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev


-- 
Christopher Schmidt
MetaCarta



More information about the Dev mailing list