- First an object representing google map properties is created with zoom level, map center and map type.
- Then a map object is created. It takes two parameters. One is the div where the map should be displayed and the other is the object which contains various properties to initialize the google map.
- With the above to lies the map can be displayed.
- Next are the two event handlers which will display the lattitude and longitude when the move is moved over the google map or when the mouse is clicked on the map.
- The event listener needs three parameters first is the map object, next is the event like onmousemove or onclick and the third parameter is the callback function to which the coordinates are passed as a parameter.
- Each time the event handlers (callback functions) are called i am updating the lattitude and longitude.
Please visit http://ecarobar.com/google-map-v3-get-langitude-and-latitude-on-mouseover/ for code and details
For live demo check here http://www.ecarobar.com/google/