Skip to content

Instantly share code, notes, and snippets.

@jaseflow
Created July 4, 2013 04:05
Show Gist options
  • Select an option

  • Save jaseflow/5924849 to your computer and use it in GitHub Desktop.

Select an option

Save jaseflow/5924849 to your computer and use it in GitHub Desktop.
var map;
var beaches = [
['Chalong Bay', 7.830051,98.349899, 4],
['Karmala', 7.949757,98.289818, 5],
['Karon', 7.843486,98.303234, 3],
['Kata', 7.821527,98.299374, 2]
];
function initializeMap() {
var mapOptions = {
zoom: 12,
scrollwheel: false,
mapTypeControlOptions: {
mapTypeIds: []
},
center: new google.maps.LatLng(7.894669,98.379822),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
setMarkers(map, beaches);
google.maps.event.addListener(marker, 'click', function() {
// Do something
});
};
function setMarkers(map,locations) {
for (var i = 0; i < locations.length; i ++) {
var region = beaches[i];
var myLatLng = new google.maps.LatLng(region[1],region[2]);
var marker = new google.maps.Marker({
position: myLatLng,
map: map
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment