Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <div id="mapa" class="mapa"></div>
            
          
!
            
              .mapa{
  position: relative;
  width: 100%;
  height: 300px;
}
            
          
!
            
              // Simples função para executar o Google Maps.
// Basta trocar os valores nas variáveis aqui em cima e tudo estará pronto.
// Não esqueça de adicionar o arquivo do Google Maps + jQuery ao seu site.
// :)

function googleMaps(id) {
  	var map,
        latitude = 48.856614, // Latitude do local
        longitude = 2.352222, // Longitudade do local
        mobile = 480, // Tamanho em pixels da tela para desabilitar o touch do mapa
        pointer = true, // Adicionar marcador ao ponto principal
        info = false, // Adiciona uma infobox abaixo do marcador
        mapName = "Casa Esperança", // O nome do seu ponto no mapa
        bgColor = "#000", // Cor do background
        fontColor = "#333333", // Cor das fontes (obrigatório 6 numeros/letras)
        roadColor = "#EEE3CD", // Cor das ruas (obrigatório 6 numeros/letras)
        roadBorder = "#C9B99F", // Cor das bordas das ruas (obrigatório 6 numeros/letras)
        placeColor = "#DACCB1", // Cor dos bairros (obrigatório 6 numeros/letras)
  		 buildColor = "#83b918"; // Cor de lugares próprios (obrigatório 6 numeros/letras)
  
  	
		// A partir daqui a mágica acontece, evite alterar ;)
		var latlng = new google.maps.LatLng(latitude, longitude);
     var isDraggable = $(document).width() > mobile ? true : false;
    
		var options = {
				backgroundColor: bgColor,
				disableDefaultUI: true,
				zoom: 17,
				center: latlng,
          draggable: isDraggable,
				scrollwheel: false,
				mapTypeId: google.maps.MapTypeId.ROADMAP,
				styles: [
					{
						"featureType": "landscape.natural",
						"elementType": "geometry.fill",
						"stylers": [
						{ "color": "#000" }
						 ]
					},
					{
						"featureType": "landscape.man_made",
						"stylers": [
						{ "color": ""+placeColor+"" }
						]
					},
					{
						"featureType": "road",
						"stylers": [
						{ "color": ""+roadColor+"" }
						]
					},
          	{
              "featureType": "poi",
              "elementType": "geometry",
              "stylers": [
                { "visibility": "on" },
                { "color": ""+buildColor+"" }
              ]
            },
					{
					 "featureType": "road",
					 "elementType": "geometry.stroke",
					 "stylers": [
						{ "color": ""+roadBorder+"" }
					 ]
				  	},
					{
					 "featureType": "road",
					 "elementType": "labels",
					 "stylers": [
						{ "color": "#000" },
      				{ "invert_lightness": "true" }
					 ]
				  	},
					{
						"elementType": "labels.text.stroke",
						"stylers": [
						{ "visibility": "off" }
					  ]
					},
					{
						"elementType": "labels.text",
						"stylers": [
						{ "color": ""+fontColor+"" }
						]
					}
				]
		};

		map = new google.maps.Map(document.getElementById(id), options);
  	
  	// Verifica se a opção do marcador foi escolhida, 
  	if(pointer === true){
      var marker = new google.maps.Marker({
          position: latlng,
          title: ""+mapName+"",
          map: map
      });
      
     // Cria uma infobox
  	if(info === true){
      var infobox = new InfoBox({
        content: ""+mapName+"",
        disableAutoPan: false,
        maxWidth: 150,
        pixelOffset: new google.maps.Size(0, 0),
        zIndex: null,
        boxStyle: {
          width: "200px",
          color: "#840000",
          textAlign: "center",
          fontWeight: "800",
          marginLeft: "-90px",
          marginTop: "15px"
        },
        infoBoxClearance: new google.maps.Size(1, 1)
    	});
      $(".gm-style-iw").next("div").hide();
      infobox.open(map, marker);
    }
    }
}

googleMaps("mapa");
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console