Google map as fixed background like on foursquare
10,376
Here's a way you can do it: http://jsfiddle.net/X5r8r/927/
html, body {
height:100%;
}
#map-container {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 0;
}
#map
{
width: 100%;
height: 100%;
}
#content
{
width: 200px;
position: absolute;
z-index: 1;
top:0;
left:0;
border: 4px solid black;
background:#fff;
padding:20px;
}
Comments
-
warmspringwinds almost 2 years
I'm trying to do something like this. I want to have google map as a fixed background and place my content(some text) on it as it's made on foursquare. Also i want to be able to scroll my content. This is my effort:
#map { width: 100%; height: 100%; position: fixed; top: 0; left: 0; bottom: 0; right: 0; z-index: 0; } #content { width: 200px; margin: auto; position: relative; z-index: 1; border: 4px solid black; }
But the map disappears. Any help will be appreciated.
-
warmspringwinds over 11 yearsThans, but when i scroll down your map seems not to be fixed. I need map to react like here: foursquare.com/…
-
warmspringwinds over 11 yearsYes, this is it! Thanks, man) Correct your answer and i'll accept it.
-
Billy Moat over 11 yearsNo worries, glad I could help.
-
warmspringwinds over 11 yearsOh, sorry, i was in hurry to accept your answer. In your solution you used static map, but i need dynamic. Here is your code with dynamic map: jsfiddle.net/X5r8r/925 unfortunately the same problem. Do you know how to solve it?
-
dube almost 11 yearsFor the record: here is the API documentation for generating those images: developers.google.com/maps/documentation/staticmaps