Created
September 3, 2013 14:27
-
-
Save mpmont/6424660 to your computer and use it in GitHub Desktop.
google maps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var map; | |
var andrecosta = new google.maps.LatLng(41.151217,-8.675815); | |
var MY_MAPTYPE_ID = 'custom_style'; | |
function initializeMap() { | |
var featureOpts = [ | |
{ | |
featureType: 'all', | |
elementType: 'all', | |
stylers: [ | |
{ "saturation": -100 }, | |
{ "lightness": -49 }, | |
{ "gamma": 0.7 }, | |
{ "weight": 2.4 } | |
] | |
}, | |
]; | |
var mapOptions = { | |
zoom: 14, | |
center: andrecosta, | |
mapTypeControlOptions: { | |
mapTypeIds: [google.maps.MapTypeId.ROADMAP, MY_MAPTYPE_ID] | |
}, | |
mapTypeId: MY_MAPTYPE_ID, | |
panControl: false, | |
zoomControl: false, | |
mapTypeControl: false, | |
scaleControl: false, | |
streetViewControl: false, | |
overviewMapControl: false | |
}; | |
map = new google.maps.Map(document.getElementById('map'), mapOptions); | |
var styledMapOptions = { | |
name: 'Custom Style' | |
}; | |
var customMapType = new google.maps.StyledMapType(featureOpts, styledMapOptions); | |
map.mapTypes.set(MY_MAPTYPE_ID, customMapType); | |
var totalFlags = $(".geoLink").length; | |
var image = 'http://monstrosecompanhia.com/testes/online/andrecosta/assets/img/system/map-marker.png'; | |
$(".geoLink").click(function(){ | |
thisLat = new google.maps.LatLng(parseFloat($(this).children('#lat').text()),parseFloat($(this).children('#lng').text())); | |
var thisMarker = new google.maps.Marker({position: thisLat, map: map, icon: image}); | |
map.panTo(thisLat); | |
}); | |
var andreMarker = new google.maps.Marker({ | |
position: andrecosta, | |
map: map, | |
icon: image | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Incluir este script | |
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> | |
e no body | |
<body onload="initializeMap()"> | |
e o mapa fica em div#map algures no site. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment