latlong.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!doctype html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>jQuery UI Spinner - Map</title>
  6. <link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
  7. <script src="http://maps.google.com/maps/api/js?sensor=false"></script>
  8. <script src="../../jquery-1.10.2.js"></script>
  9. <script src="../../external/jquery.mousewheel.js"></script>
  10. <script src="../../ui/jquery.ui.core.js"></script>
  11. <script src="../../ui/jquery.ui.widget.js"></script>
  12. <script src="../../ui/jquery.ui.button.js"></script>
  13. <script src="../../ui/jquery.ui.spinner.js"></script>
  14. <link rel="stylesheet" href="../demos.css">
  15. <script>
  16. $(function() {
  17. function latlong() {
  18. return new google.maps.LatLng( $("#lat").val(), $("#lng").val() );
  19. }
  20. function position() {
  21. map.setCenter( latlong() );
  22. }
  23. $( "#lat, #lng" ).spinner({
  24. step: .001,
  25. change: position,
  26. stop: position
  27. });
  28. var map = new google.maps.Map( $("#map")[0], {
  29. zoom: 8,
  30. center: latlong(),
  31. mapTypeId: google.maps.MapTypeId.ROADMAP
  32. });
  33. });
  34. </script>
  35. <style>
  36. #map {
  37. width:500px;
  38. height:500px;
  39. }
  40. </style>
  41. </head>
  42. <body>
  43. <label for="lat">Latitude</label>
  44. <input id="lat" name="lat" value="44.797">
  45. <br>
  46. <label for="lng">Longitude</label>
  47. <input id="lng" name="lng" value="-93.278">
  48. <div id="map"></div>
  49. <div class="demo-description">
  50. <p>Google Maps integration, using spinners to change latitude and longitude.</p>
  51. </div>
  52. </body>
  53. </html>