I am using google map with API.
I am running it on a responsive website. The issue i am having is when i apply width: 100% to it, it goes blank. I tried by warping it in outer div but still no luck.
I've read other Stack questions but did't find any working solution for this.
HTML
<div id="mapCanvas" class="mapCanvas"></div>
CSS
.mapCanvas{
width: 800px; /* When i set it to 100%, Map goes BLANK */
height: 200px;
}
.mapContainer
{
display:inline-block;
}
.mapContainer div, .mapContainer ul
{
float:left;
}
.infoWindow h1 {
font-size: 1.6em;
text-align: center;
padding-bottom: 1px;
}
.infoWindow {
overflow: hidden;
}
JS
markers = [];
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(51.061150138439515, -114.05261809049074),
zoom: 14,
mapTypeId: google.maps.MapTypeId.ROADTYPE,
panControl: false,
zoomControl: false,
mapTypeControl: false,
scaleControl: false,
streetViewControl: false
};
map = new google.maps.Map(document.getElementById("mapCanvas"),mapOptions);
var marker0 = new google.maps.Marker({
position: new google.maps.LatLng (51.063838646941576,-114.05572414398193),
map: map,
icon: "http://www.earthpoint.us/Dots/GoogleEarth/paddle/ylw-blank.png"
});
markers.push(marker0);
var infowindow0 = new google.maps.InfoWindow({
content: "<div class='infoWindow'><h1> We are here </h1></div>",maxWidth: 350
});
google.maps.event.addListener(marker0, "click", function()
{
infowindow0.open(map,marker0);
});
}
google.maps.event.addDomListener(window, "load", initialize);
Can anyone help?