Skip to content

Instantly share code, notes, and snippets.

@mashit
Created July 30, 2012 08:21
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 mashit/3205645 to your computer and use it in GitHub Desktop.
Save mashit/3205645 to your computer and use it in GitHub Desktop.
Jquery Ui Map example (Locations are inaccurate)
<html>
<head>
<title>Map Demo
</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&libraries=places"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="http://jquery-ui-map.googlecode.com/svn/trunk/ui/jquery.ui.map.js"></script>
<script type="text/javascript" src="http://jquery-ui-map.googlecode.com/svn/trunk/ui/jquery.ui.map.services.js"></script>
<script type="text/javascript" src="http://jquery-ui-map.googlecode.com/svn/trunk/ui/jquery.ui.map.extensions.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#map_canvas').gmap({ 'center': '39.744244, -104.834960' });
$('#map_canvas').gmap().bind('init', function() {
$('#map_canvas').gmap('addControl', 'control', google.maps.ControlPosition.LEFT_TOP);
$('#map_canvas').gmap('option', 'zoom', 12);
$('#map_canvas').gmap('addMarker', { /*id:'m_1',*/ 'position': '39.744244, -104.834960', 'bounds': false } );
$('#map_canvas').gmap('displayDirections', { 'origin': '39.744783, -104.831709', 'destination': '39.744244, -104.834960', 'travelMode': google.maps.DirectionsTravelMode.WALKING }, { 'panel': document.getElementById('panel') }, function(result, status) {
if ( status === 'OK' ) {
alert('Results found!');
}
});
});
});
</script>
</head>
<body>
<div id="map_canvas" style="height:600px;"></div>
<div id="panel" style="height: 200px;width: 300px;"></div>
</body>
</html>
@cpapidas
Copy link

Update the links please, not working anymore :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment