jQM - Gmap Demo

by Dragan Gaić

HTML

<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script src="http://jquery-ui-map.googlecode.com/svn/trunk/ui/jquery.ui.map.js"></script>
<script src="http://jquery-ui-map.googlecode.com/svn/trunk/ui/jquery.ui.map.services.js"></script>
<script src="http://jquery-ui-map.googlecode.com/svn/trunk/ui/jquery.ui.map.extensions.js"></script>
<!DOCTYPE html>
<html>
    
    <head>
        <title>jQM Complex Demo</title>
        <meta name="viewport" content="initial-scale=1, maximum-scale=1" />
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" />
        <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script>
        <script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
    </head>
    
    <body>
        <div data-role="page" id="index">
            <div data-theme="a" data-role="header">
                 <h3>
                First Page
            </h3>

            </div>
            <div data-role="content" id="content">
                <div id="map_canvas" style="height:100%"></div>
            </div>
            <div data-theme="a" data-role="footer" data-position="fixed">
                 <h3>
                First Page
            </h3>

            </div>
        </div>
    </body>

</html>

CSS

#content {
    padding: 0;
    position : absolute !important;
    top : 40px !important;
    right : 0;
    bottom : 40px !important;
    left : 0 !important;
}

JavaScript

$(document).on('pageshow', '#index', function (e, data) {

    setTimeout(function () {
        // This is the minimum zoom level that we'll allow
        var minZoomLevel = 12;

        var map = new google.maps.Map(document.getElementById('map_canvas'), {
            zoom: minZoomLevel,
            center: new google.maps.LatLng(38.50, -90.50),
            mapTypeId: google.maps.MapTypeId.ROADMAP
        });
    }, 1);
});