我的頁面已經加載谷歌地圖,但使用jquery我隱藏它。點擊按鈕,它應該顯示我的谷歌地圖加載在該頁面。但我無法看到完整的地圖,即。我只看到地圖的一部分。 下面是我的代碼: -谷歌地圖 - API加載速度很慢
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style id="my-css">
map,div[map] {
display: block;
width: 600px;
height: 400px
}
</style>
<script src="https://maps.google.com/maps/api/js?sensor=false"></script>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.5/angular.min.js"></script>
<script src="scripts/plunkr.js"></script>
<script src="scripts/app.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&sensor=true&key=ABQIAAAAa24xicak8_ghHX58i7La7hRFh9iM79SNC94rOejOtdMRvQmJiBS6Uv5F_1BNSh9ZuSzFXyekHISgew"> </script>
<script
src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<script>
function initialize()
{
var mapProp = {
center:new google.maps.LatLng(51.508742,-0.120850),
zoom:7,
mapTypeId:google.maps.MapTypeId.ROADMAP
};
var map=new google.maps.Map(document.getElementById("map-canvas"),mapProp);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<script>
$(document).ready(function(){
$("#maps12").hide();
$("button").click(function(){
$("#maps12").show();
});
});
</script>
<script src="../dist/ng-map.min.js"></script>
</head>
<body>
<div class="main">
<header>
DEMO
</header>
<section>
<div id="maps12">
<div id="map-canvas" style="width: 600px; height: 400px"></div>
</div>
</section>
<footer>
<button>click me</button>
</footer>
</div>
</body>
</html>
他們的指令適用於谷歌地圖AngularJS和UI地圖看@ 的http://角谷歌-maps.org/和http://angular-ui.github.io/ui-map/ –