GoogleMaps is shown as gray box instead of map. And on windows resize it works correctly.
On window load maps show like this:
After window resize map works correctly:
<div style="width:100%; height:400px; padding:0; margin:0; border:3px solid gainsboro; border-radius:3px;">
<div id="canvas" style="width:100%; height:100%; padding:0; margin:0;"></div>
</div>
<script src="https://maps.googleapis.com/maps/api/js?key=MY_API_KEY"></script>
<script>
var map;
var latLong;
$(window).load(function () {
latLong = new google.maps.LatLng(47.0303105, 28.815481);
map = new google.maps.Map(document.getElementById('canvas'), {
center: latLong,
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoom: 14
});
console.log("Map is ready.")
});
</script>
PS Map is declared in a bootstrap modal div
Thanks for help.