none
Problem in resizing bing map. RRS feed

  • Question

  • I have given 100% width to the div in which I am loading bing map. But map convert it into pixel and I am unable to shrink the map when get resize.
    Friday, February 27, 2015 10:56 AM

Answers

  • The map doesn't convert the width to pixels. It only returns pixels if you ask for it's width. Here is an example of a full screen map that resizes as you resize the browser:

    <!DOCTYPE html>
    <html>
    <head>
      <title></title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    
      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&mkt=de-de"></script>
      
      <script type="text/javascript">
    	var map;
    	
    	function GetMap()
    	{	
    		map = new Microsoft.Maps.Map(document.getElementById("myMap"), { 
    			credentials: "YOUR_BING_MAPS_KEY"
    		});
    	}
    	</script>
    	<style>
    	html, body {
    		width:100%;
    		height:100%;
    		margin:0;
    		padding:0;
    	}	
    	</style>
    </head>
    <body onload="GetMap();">
    	<div id='myMap' style=";width:100%;height:100%;"></div>
    </body>
    </html>

    http://rbrundritt.wordpress.com

    Friday, February 27, 2015 5:04 PM