[OpenLayers-Users] map with position:absolute not displayed in ie <= 7

Nathan Gerber ngerber999 at gmail.com
Mon Jul 26 19:54:28 EDT 2010


Arno,

I have also encountered this issue. The solution I came up with was to
switch the div to position:fixed and to have a helper JavaScript function to
resize the div every time the window changed size. If you plan on having
items on the page other than just the map you may need to adjust your CSS
positioning for those items as well if you end up going this route.

function windowResize() {
        /* Do Resizing events through JavaScript */
        /* Detect Height and Width of page */
        /* Do whatever adjustments you wish to add to the height and width,
then set to the div */
        /* div.style.top = "0px"; // How far from the top you wish the div
to start at
        div.style.left = "200px"; // How far from the left you wish the div
to start at
        div.style.height = newHeight+"px";
        div.style.width = newHeight+"px";*/
}
window.onresize = windowResize;

--
Nathan Gerber


On Mon, Jul 26, 2010 at 5:35 PM, arno <arno at renevier.net> wrote:

> Hi,
> I want to have displayed on the whole page except a 2em height footer.
>
> So, I've tried to set my css to :
>
> #map {
>    position: absolute;
>    top: 0; left: 0; right: 0;
>    bottom: 2em;
> }
>
> It works fine in every browser I tested except in ie6 and ie7.
> For those browsers, I absolutely need to set a width and height css
> properties. For example: width: 100% and height: 100%, otherwise the map
> does
> not show at all: it stays a white area. But as height: 100% - 2em does not
> exist, I can't have the behaviour I want.
>
> What's strange is that a "normal" div (not an ol map) is correctly
> displayed
> with { position: absolute; top: 0; left: 0; right: 0; bottom: 2em; } in ie.
>
> What's strange also is that map images are downloaded from the tile server.
>
> Here is an example of a map showing correctly except in ie6 and ie7:
>
> http://renevier.net/bugs/ol_absolute.html
>
> Do you have any clue of why this problem happens, and/or any workaround ?
>
> regards
> arno
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
>
> iEYEARECAAYFAkxN/6QACgkQ7Z0ZxRdGQ+fenACgiXnNtuYcHs/MTpQOUox9Vj7T
> Xa8AnRUfAU+DXVugoiKcaO2eiH0HUW20
> =QE60
> -----END PGP SIGNATURE-----
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100726/f8d24e0e/attachment.html


More information about the Users mailing list