Responsive google map – part 2
April 17th, 2012 by EdwardThis is part 2 of my attempt to get google maps to work responsively. Part 1 is about getting the zoom to display properly with a responsive design.
Having got the zoom control to work properly its now time to get the parts of the map to adapt as the width alters. I thought this was going to be a bit of a problem. As it happens it turned out to be really easy!
This light box shows the idea…
So…there are 3 divs, and they all work in my case in exactly the same way
So for the wider screen, I set a fixed with thus:
#mapInstructions {
width:680px;
float:right;
}
For the intermidiate screen this became
#mapInstructions {
width:65%;
}
I guess I probably should have added float:none; really
And for the narrow, mobile type screens this turned into…
#mapInstructions {
width:98%;
margin:5px 1% 5px 1%;
}
I also did the same css for the #map_canvas and #directionsPanel and so everything lines up nicely! Honestly, I was expecting a LOT more hassel than this.
A small addendum…
Of course, if you drag the browser window its possible to move the marker off the edge of the browser – ie no marker on the map – it doesn’t physically re-load the map… I don’t consider this to be much of a problem though, since how many users are really going to re-size their browser. It doesn’t matter what size you load into, the marker stays central.
This is part 2 of my “Google maps and responsive design” investiagtions.
You can read part 1 about getting the zoom control to display properly


ee-web design and development are really pleased to announce the launch of another website for a SME client. This time its a independent coffee lounge in Enfield, North London and they probably make the best coffee money can buy. Or so they say. The site, based around the joomla CMS features a bespoke look – no templates here. Its simple, quick and elegant – or so we think anyway!