xkeshav

dual google map

Dec 26th, 2011
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.77 KB | None | 0 0
  1. <html>
  2. <head>
  3. <style>
  4. .mapzm {
  5.     float: left;
  6.     height: 217px;
  7.     margin: 8px 0 0 8px;
  8.     padding: 0;
  9.     width: 223px;
  10. }
  11. .mapsmpl {
  12.     float: left;
  13.     height: 310px;
  14.     margin: 8px 0 10px 15px;
  15.     padding: 0;
  16.     width: 699px;
  17. }
  18. </style>
  19. <script src="https://maps.googleapis.com/maps/api/js?v=3&sensor=false"></script>
  20. <script>
  21.     var geocoder;
  22.     var latLng = new google.maps.LatLng(-33.873651,151.2068896);
  23.     var map;
  24.     var marker;
  25.     function initialize()
  26.     {
  27.     //-------------------------Left side Map ( mini Map )----------------------------------
  28.             var myOptions = {
  29.                     zoom :5,
  30.                     maxZoom :11, // upto 5 KM
  31.                     minZoom :3,
  32.                     center: latLng,
  33.                     disableDefaultUI: true,
  34.                     zoomControl: true,
  35.                     scaleControl: true,
  36.                     scrollwheel: false,
  37.                     draggableCursor: 'crosshair',
  38.                     draggingCursor : 'crosshair',
  39.                     mapTypeId: google.maps.MapTypeId.ROADMAP
  40.             }
  41.             var minimap = new google.maps.Map(document.getElementById("minimap"),myOptions);
  42.             var marker = new google.maps.Marker({
  43.                     map: minimap,
  44.                     position:latLng,
  45.                     draggable:true
  46.             });
  47.             google.maps.event.addListener(minimap, 'dragend', function(event) {
  48.                      placeMarker(minimap,marker);
  49.            });
  50.  
  51.      //----------------------------- Right side Map--------------------------------------//
  52.              var rightMapOpt = {
  53.                 zoom :8,
  54.                 panControl: false,
  55.                 zoomControl: true,
  56.                 scaleControl: true,
  57.                 mapTypeId: google.maps.MapTypeId.ROADMAP
  58.             };
  59.             map = new google.maps.Map(document.getElementById("map_canvas"),rightMapOpt);
  60.  
  61.             var markerBounds = new google.maps.LatLngBounds();
  62.  
  63.  
  64.     }
  65.      google.maps.event.addDomListener(window, 'load', initialize);
  66.      function placeMarker(minimap,location) {
  67.             var latLng = location.getPosition(); // returns LatLng object
  68.                      console.log('dragends now'+latLng);
  69.                      minimap.setCenter(latLng); // setCenter takes a LatLng object
  70.                      map.setCenter(minimap.getCenter());
  71.                      console.log('Here'+location);
  72.                      var c = minimap.getCenter();
  73.            }
  74. </script>
  75. </head>
  76. <body>
  77.  <div class="mapzm">
  78.        <div id="minimap" style="width: 225px; height: 210px;"></div>
  79.  </div>
  80.  <div class="mapsmpl">
  81.         <div id="map_canvas" style="width: 700px; height: 310px;"></div>
  82.  </div>
  83. </body>
  84. <html>
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91. </script>
Add Comment
Please, Sign In to add comment