function initialize() { "use strict"; var myLatlng = new google.maps.LatLng(42.684876, 9.306562); var mapOptions = { zoom: 16, center: myLatlng } var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); var marker = new google.maps.Marker({ position: myLatlng, map: map, title: 'Hello World!' }); } function loadScript() { "use strict"; setTimeout(function (){ $('#map-canvas').css({'display':'block'}); var script = document.createElement('script'); script.type = 'text/javascript'; script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&' + 'callback=initialize'; document.body.appendChild(script); google.maps.event.trigger(map, 'resize'); }, 500); }