I am trying to incorporate google maps into a simple jquery mobile application. I am able to create the map using the pageinit event in jqm. The html gets appended to my container div like it should but the height turns out to be 0. I would like the map to be 100% of the area of the screen.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<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.googleapis.com/maps/api/js?sensor=false"></script>
</head>
<body>
<div data-role="page" id="indexPage" data-add-back-btn="true">
<div data-role="header">
<a href='#' class='ui-btn-left ui-btn-back' data-icon='arrow-l'>Back</a>
<h1>Page Title</h1>
<a href="index.html" data-icon="gear" class="ui-btn-right">Refine</a>
</div>
<div id="map_canvas" style="width:100%;height:100%;"></div>
<div data-role="footer" data-position="fixed">
<h4>Page Footer</h4>
</div>
</div>
<script>
$( '#indexPage' ).live( 'pageinit',function(event){
var myOptions = {
zoom: 11,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var mapElement = $("#map_canvas");
var map = new google.maps.Map(mapElement[0], myOptions);
});
</script>
</body>
</html>