970_90

Saturday, 11 April 2015

How can I check whether Google Maps is fully loaded in GMaps v3


Problem 1: How can I check whether Google Maps is fully loaded in GMaps v3?
Problem Description: I want to add few codes just after the google map is fully loaded in browser.

Solution:
google.maps.event.addListenerOnce(map, 'idle', function(){
    // console.log('Google map is fully loaded in Gmap V3')
});

You can write your code inside this {}, It will be called when Google map V3 is fully loaded OR failed  to load due to any reason.



Problem 2: How can I change the color of a Google Maps marker In Gmaps 3?
Problem Description:
I want to change the color of default google markers
OR
want to show my image instead of default google marker.
var beachMarker = new google.maps.Marker({
  position: myLatLng,
  map: map,
  icon: 'mymarker.png'
});

Replace the "mymarker.png" with your image including path.



No comments:

Post a Comment