Show and Hide minimap like http://maps.live.com/ still not clear

I want to show and hide the minimap the way it is done inhttp://maps.live.com/ andhttp://local.live.com. Can u plz help me and send me some links or sample code to do this.

Thanking You,

Vishal Sharma

[358 byte] By [Bunty120] at [2008-1-7]
# 1

The code that I have used to diaply the minimap is following, plz correct me and help me.

function ShowMiniMap()

{

if (map.GetMapMode() == 2)

{

map.SetMapMode(VEMapMode.Mode2D);

}

// map.ShowMiniMap(630, 0);

//map.ShowMiniMap(803, 0);

map.ShowMiniMap(0,0);

}

Thanks,

Vishal

Bunty120 at 2007-10-2 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...
# 2
That syntax looks correct. The Show/Hide visual sliding effects of the minimap on local.live.com are relatively simple javascript DHTML tricks, with a carefully positioned onclick event tied to the arrow in the corner to toggle between the MiniMapLarge and MiniMapSmall enums. Most of the popular javascript sites on the internet will have functional examples of how to slide DOM objects around -- dynamicdrive, for example.
JaredH at 2007-10-2 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...
# 3

Hello Jared,

Thanks for the earlier reply but it was not much helpful .This is still noy clear how to do , can u plz provide me the sample code of how it is done in http://maps.live.com/. If possible please send me the coding for this.Or an example to do this would be of great help.Plz saend me a sample coide which is really helpful.Your quick reply will be highly appreciated.

Thanking You,

Vishal Sharma

Bunty120 at 2007-10-2 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...
# 4

Vishal,

You may want to consider creating your own mini-map. I've written an article on how to do that here:
http://www.viavirtualearth.com/vve/Articles/MiniMap.ashx

DerekChan at 2007-10-2 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...
# 5

Hi again Vishal; basically you have two options to achieve that effect; like Derek points out in the customization article, you can roll your own minimap and/or override the inherent css properties of the existing one.

The other option (and not quite visually equal to local.live) would be to iteratively adjust the parameters within the ShowMiniMap(x,y) method inside a controlled loop. The example below loads a default map with minimap, then slides the mini map off to the left inside a javascript timer function. You could take these same methods and tie them to an onclick event somewhere to slide the mini map in whatever direction you like, and then back again by reversing the incremental movement.

One advantage to this approach is that you are using a documented public method of the API. If you go the CSS override route, you run the risk of having the VE devs change the naming convention unbeknownst to your code.

Code Snippet

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=5"></script>
<script>

var map = null;
var start
var timerID = null
var timerRunning = false
var delay = 0
function GetMap()
{
map = new VEMap('myMap');
map.LoadMap(new VELatLong(38,-171),2,'r',false,VEMapMode.Mode2D,false);
// startup location of minimap
map.ShowMiniMap(200,200);
InitializeTimer();
}
function InitializeTimer()
{
start = 200;
StopTheClock();
StartTheTimer();
}
function StopTheClock()
{
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function StartTheTimer()
{
if (start==-200)
{
StopTheClock();
// mini map hidden
}
else
{
// change to improve rendering
start = start - 2;
// for a Show() routine, simply reverse the incremental values of var start
map.ShowMiniMap(start,200);
timerRunning = true;
timerID = self.setTimeout("StartTheTimer()", delay);
}
}

</script>
</head>
<body onload="GetMap();">
<div id='myMap' style="position:relative; width:1000px; height:800px;"></div>
</body>
</html>

JaredH at 2007-10-2 > top of Msdn Tech,Windows Live Developer Forums,Virtual Earth: Map Control Development...

Windows Live Developer Forums

Site Classified