Advertisement
Guest User

Untitled

a guest
Dec 10th, 2012
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.60 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.     <head>
  4.         <meta charset="utf-8" />
  5.         <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  6.         <meta name="apple-mobile-web-app-capable" content="yes" />
  7.         <title>OpenStreetMap with Google Maps v3 API</title>
  8.         <style type="text/css">
  9.             html, body, #map {
  10.                 height: 100%;
  11.                 margin: 0;
  12.                 padding: 0;
  13.                
  14.             }
  15.            
  16.             body:before {
  17.                 content: "";
  18.                 position: fixed;
  19.                 top: -10px;
  20.                 left: 0;
  21.                 width: 100%;
  22.                 height: 10px;
  23.  
  24.                 -webkit-box-shadow: 0px 0px 10px rgba(0,0,0,.8);
  25.                     -moz-box-shadow: 0px 0px 10px rgba(0,0,0,.8);
  26.                     box-shadow: 0px 0px 10px rgba(0,0,0,.8);
  27.  
  28.                 z-index: 100;
  29.             }
  30.            
  31.             .content{
  32.                 z-index:0;
  33.                 background-color:fffff;
  34.                 position: absolute; top: 0; left: 0;
  35.                 width: 900;
  36.                 height: auto;
  37.                 margin-right: auto;
  38.                 margin-left: auto;
  39.                
  40.                
  41.             }
  42.         </style>
  43.     </head>
  44.     <body>
  45.         <div id="map"></div>
  46.  
  47.         <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
  48.         <script type="text/javascript">
  49.             var element = document.getElementById("map");
  50.  
  51.             /*
  52.             Build list of map types.
  53.             You can also use var mapTypeIds = ["roadmap", "satellite", "hybrid", "terrain", "OSM"]
  54.             but static lists sucks when google updates the default list of map types.
  55.             */
  56.             var mapTypeIds = [];
  57.             for(var type in google.maps.MapTypeId) {
  58.                 mapTypeIds.push(google.maps.MapTypeId[type]);
  59.             }
  60.             mapTypeIds.push("OSM");
  61.  
  62.             var map = new google.maps.Map(element, {
  63.                 center: new google.maps.LatLng(34.75148606442704,-92.26387023925781),
  64.                 zoom: 12,
  65.                 mapTypeId: "OSM",
  66.                 mapTypeControlOptions: {
  67.                     mapTypeIds: mapTypeIds
  68.                 }
  69.             });
  70.  
  71.             map.mapTypes.set("OSM", new google.maps.ImageMapType({
  72.                 getTileUrl: function(coord, zoom) {
  73.                     return "http://tile.openstreetmap.org/" + zoom + "/" + coord.x + "/" + coord.y + ".png";
  74.                 },
  75.                 tileSize: new google.maps.Size(256, 256),
  76.                 name: "OpenStreetMap",
  77.                 maxZoom: 18
  78.             }));
  79.         </script>
  80.         </div>
  81.        
  82.         <div class="content">
  83.         Hey
  84.         </div>
  85.     </body>
  86. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement