If you take a look at maps.live.com you’ll see the Mini Map is in the Top Right corner of the map. Virtual Earth doesn’t have any alignment options built in when showing the Mini Map. It just allows you to position the mini map using x and y offset coordinates relating to the top left corner of the map. This makes it really easy to show the mini map in relation to the top left corner, but what makes this tricky is the dashboard is already there.
Here’s small example I wrote up on how to align the Mini Map in the Top Right corner of the map. This code also hooks into the Maps onresize event so it can move the Mini Map to the desired location when ever the map is resized.
Here’s a screenshot of it in action:
Here’s the code:
This code works in IE, Firefox and Safari 3 on Windows. I haven’t tested any other browsers, but I assume it’ll work in others as well. Another thing to note is that this code will only work if there is only a single Virtual Earth map on the page; it’ll break with multiple maps on the same page.
Sorry, I didn’t have time to write up a nice article surrounding this code. But, I did add a bunch of comments to make it more readable.
This blog post is licensed under the Creative Commons Attribution 3.0 United States License, unless explicitly stated otherwise within the blog post content. All other content on this website is not licensed under Creative Commons licensing.