Skip to content

Instantly share code, notes, and snippets.

@Thibaut-B
Created February 19, 2015 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thibaut-B/d6b6caec7fa47cabe87e to your computer and use it in GitHub Desktop.
Save Thibaut-B/d6b6caec7fa47cabe87e to your computer and use it in GitHub Desktop.
Google Maps with jQuery Mobile
<!DOCTYPE HTML>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Google Maps</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" />
<script src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<style>.page-map, .ui-content, #map-canvas { width: 100%; height: 100%; padding: 0; }</style>
<script>
$('.page-map').live("pagecreate", function() {
//lat and lng of Paris
var lat = 48.857035,
lng = 2.352448;
var latlng = new google.maps.LatLng(lat, lng);
var myOptions = {
zoom: 14,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map-canvas"),myOptions);
});
</script>
</head>
<body>
<div data-role="page">
<div data-role="header"><h1>Map View</h1></div>
<div data-role="content">
<div id="map-canvas">
<!-- map loaded here... -->
</div>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment