MrNase
20 Jun 2010, 7:19 AM
Hey guys,
I am playing around with the examples and I currently try to extend the 'Guide example'.
What I want is a new button that centers the map to my current location. Just in case I scroll around and want to get back.
I created the button and that's already working but I am struggling with the rest.
Here's what I got:
var takeMeHome = function() {
var coords = map.geo.coords;
map.center(new google.maps.LatLng(coords.latitude, coords.longitude));
}
The only thing it does is that the screen flickrs when I click (touch.. ;)) the button, nothing more.
I know the Google Maps API and I now that there is a 'setCenter()' function but I already tried that with no luck.
Can someone please point me in the right direction? Thanks! :)
For some strange reason, all examples that use the Geolocation only work in Firefox (with a broken layout) and on my iPhone. Safari 5 refuses to load the map which makes debugging a little complicated.
I am playing around with the examples and I currently try to extend the 'Guide example'.
What I want is a new button that centers the map to my current location. Just in case I scroll around and want to get back.
I created the button and that's already working but I am struggling with the rest.
Here's what I got:
var takeMeHome = function() {
var coords = map.geo.coords;
map.center(new google.maps.LatLng(coords.latitude, coords.longitude));
}
The only thing it does is that the screen flickrs when I click (touch.. ;)) the button, nothing more.
I know the Google Maps API and I now that there is a 'setCenter()' function but I already tried that with no luck.
Can someone please point me in the right direction? Thanks! :)
For some strange reason, all examples that use the Geolocation only work in Firefox (with a broken layout) and on my iPhone. Safari 5 refuses to load the map which makes debugging a little complicated.