Reputation: 3270
This is my first time using jQuery and Google Maps. As such I've literally copy and pasted the google maps hello world page and include the jQuery Mobile and I just get an empty page saying "Loading". I'm ready not sure why?
HTML and JS:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<link rel="stylesheet" type="text/css" href="css/mystyles.css">
<link rel="stylesheet" href="css/jquery.mobile.css"/>
<link rel="stylesheet" href="css/jquery.mobile.structure.css"/>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=[key]&sensor=true">
</script>
<script type="text/javascript" src="js/myscript.js"></script>
<script type="text/javascript" src="js/cordova-2.3.0.js"></script>
<script type="text/javascript">
function initialize()
{
var mapOptions = {
center: new google.maps.LatLng(-34.397, 150.644),
zoom: 8
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
}
</script>
</head>
<body onload="initialize()">
<div id="map-canvas"></div>
</body>
</html>
Where it says MYAPIKEY I put my key there. I'm not sure how these are falling apart??
UPDATE
Changed code to above. When I remove the links to my jQuery Mobile files everything loads fine...
Upvotes: 0
Views: 88
Reputation: 17735
Check this working demo
Upvotes: 1
Reputation: 1489
I would recommend using the pageshow event rather than pageinit because the later is too early in the page lifecycle
$(document).on('pageshow', ...);
Also avoid using a self closing tag in map canvas
<div id="map-canvas"></div>
Upvotes: 0