[OpenLayers-Users] ZoomToExtent works in Firefox, Safari and IE7, but not in IE6

sendeman martijnsendenspam at gmail.com
Mon May 25 10:40:20 EDT 2009


Hi all,

I'm trying to make a 'fluid' layout, in which the viewport of the map
changes with changes in the size of the browser window. I have some html and
css worked out that do this without javascript in IE6. The only problem I
have is that the initial zoom level doesn't work in IE 6. IE 6 zooms in to
the maximum level. Other browsers (IE7, FF, Safari, Chrome) do set the zoom
level correctly.

I set the zoom level as follows:

map.zoomToExtent(new
OpenLayers.Bounds(3.27392578125,50.69471783819287,7.294921875,53.67068019347264));

What is it that makes IE 6 go wrong?

Any help would be greatly appreciated!

Below is the entire code of my test-site.

Best regards,
Martijn Senden.

____________________________
__________</CODE>__________
____________________________

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html lang="NL">
 <head>

   <title>minOpenLayers.aspx</title>

   <script type="text/javascript" src="javascript/OpenLayers.js"></script>

    <!--[if lt IE 8]>
      <script type="text/javascript"
src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js"></script>
    <![endif]-->

   <script type="text/javascript">

       var map, layer;

       function init(){

           map = new OpenLayers.Map( 'map' );

           layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );

           map.addLayer(layer); 
           
           map.zoomToExtent(new
OpenLayers.Bounds(3.27392578125,50.69471783819287,7.294921875,53.67068019347264));
       }
   </script>

   <style type="text/css">



           #map

           {

               background-color: Red;

               position: absolute;

            width: 100%;

               height: 100%;

           }



           #mapWrapper {

            position: absolute;

            background-color: Blue;

            top: 76px;

            bottom: 0px;

            left: 0px;

            right: 0px;

           }

       </style>



 </head>



 <body onload="init()">

   <div id="mapWrapper"><div id="map" class="smallmap"></div></div>

 </body>

</html>
____________________________
__________</CODE>__________
____________________________
-- 
View this message in context: http://n2.nabble.com/ZoomToExtent-works-in-Firefox%2C-Safari-and-IE7%2C-but-not-in-IE6-tp2969934p2969934.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.




More information about the Users mailing list