Build jQuery UI Spinner - Map in JavaScript

Description

The following code shows how to build jQuery UI Spinner - Map.

Example


<!-- Revised from demo code on http://jqueryui.com/ -->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Spinner - Map</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script>
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<!-- www . j  a  va2 s . c o m-->
<script>
$(function() {
function latlong() {
return new google.maps.LatLng( $("#lat").val(), $("#lng").val() );
}
function position() {
map.setCenter( latlong() );
}
$( "#lat, #lng" ).spinner({
step: .001,
change: position,
stop: position
});

var map = new google.maps.Map( $("#map")[0], {
zoom: 8,
center: latlong(),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
});
</script>
<style>
#map {
width:500px;
height:500px;
}
</style>
</head>
<body>

<label for="lat">Latitude</label>
<input id="lat" name="lat" value="44.797">
<br>
<label for="lng">Longitude</label>
<input id="lng" name="lng" value="-93.278">

<div id="map"></div>

<div class="demo-description">
<p>Google Maps integration, using spinners to change latitude and longitude.</p>
</div>
</body>
</html>

Click to view the demo

The code above generates the following result.

Build jQuery UI Spinner - Map in JavaScript
Home »
  Javascript Tutorial »
    jQuery UI »
      Spinner
Javascript Tutorial Spinner
Build jQuery UI Spinner - Currency in JavaS...
Build jQuery UI Spinner - Decimal in JavaSc...
Build jQuery UI Spinner - Default functiona...
Build jQuery UI Spinner - Map in JavaScript
Build jQuery UI Spinner - Overflow in JavaS...
Build jQuery UI Spinner - Time in JavaScrip...