有人可以看看我的代碼並告訴我我做錯了什麼嗎?我花了很多時間嘗試不同的事情,但都沒有成功。坦克給每個可以幫助我的人!jQuery Mobile Google地圖 - 地圖僅在重新載入後顯示
- 調用這個頁面直接作用
- 呼籲從以前的頁面此頁面鏈接類型「外部」的作品
- 調用該側通常是從一個jQueryMobile頁面這一項,不能正常工作,並顯示地圖空,再點擊刷新後,一切都是完美的
代碼:
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="minimum-scale=1.0, width=device-width, maximum-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true&libraries=places"></script>
</head>
<body>
<div data-role="page" id="basic_map">
<script type="text/javascript">
$("div:jqmData(role='page'):last").bind('pageinit', function() {
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position){
initialize(position.coords.latitude,position.coords.longitude);
});
}
});
function initialize(lat,lng) {
var latlng = new google.maps.LatLng(lat, lng);
var myOptions = {
zoom: 12,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
</script>
<div data-role="header" data-theme="b" data-position="fixed" data-inset="false">
<h1>My</h1>
<a href="index.html" data-icon="home" class="ui-btn-right" data-iconpos="notext" >Home</a>
</div>
<div data-role="content">
<h4>Map</h4>
<div class="ui-bar-c ui-corner-all " >
<div id="map_canvas" style="height:300px;"></div>
</div>
</div>
</div>
</body>
</html>
1)我試圖將我現有的Java腳本恰到好處前