Advertisement
Guest User

Travel planer

a guest
Jan 12th, 2015
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. <!DOCTYPE html>
  4. <html>
  5.   <head>
  6.     <title>Planera din resa</title>
  7.     <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
  8.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9.     <style>
  10.       html, body, #map-canvas {
  11.         height: 100%;
  12.         margin: 0px;
  13.         padding: 0px
  14.       }
  15.     </style>
  16.    
  17.     <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
  18.     <script src="https://maps.googleapis.com/maps/api/js?signed_in=true&v=3.exp&libraries=places&key=My_key&sensor=false">
  19.     </script>
  20.  
  21.  
  22.     <script type="text/javascript">
  23. var map;
  24.  
  25. function initialize()
  26. {
  27.   var mapOptions =
  28.   {
  29.     zoom: 2,
  30.     center: {lat: 0.0, lng: 0.0}
  31.   };
  32.   var map = new google.maps.Map(document.getElementById('map-canvas'),
  33.     mapOptions);
  34.  
  35.     google.maps.event.addListener(map, 'rightclick', function(event) {
  36.         var marker = new google.maps.Marker({
  37.             position: event.latLng, //map Coordinates where user right clicked
  38.             map: map,
  39.             draggable:true, //set marker draggable
  40.             animation: google.maps.Animation.DROP
  41.         });
  42.     });
  43.  
  44.   //Content structure of info Window for the Markers
  45.         var contentString = $('<div class="marker-info-win">'+
  46.         '<div class="marker-inner-win"><span class="info-content">'+
  47.         '<h1 class="marker-heading">New Marker</h1>'+
  48.         'This is a new marker infoWindow'+
  49.         '</span>'+
  50.         '</div></div>');
  51.            
  52.         //Create an infoWindow
  53.         var infowindow = new google.maps.InfoWindow();
  54.        
  55.         //set the content of infoWindow
  56.         infowindow.setContent(contentString);
  57.        
  58.         //add click event listener to marker which will open infoWindow          
  59.         google.maps.event.addListener(marker, 'click', function() {
  60.             infowindow.open(map,marker); // click on marker opens info window
  61.         });
  62. }
  63.  
  64.  
  65. google.maps.event.addDomListener(window, 'load', initialize);
  66.  
  67.  
  68.     </script>
  69.   </head>
  70.   <body>
  71.     <div id="map-canvas"></div>
  72.   </body>
  73. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement