Hello.
I am basically trying to keep the map from refreshing to some static
center point and zoom when the page refreshes.
by doing this i am storing the last lat,lng and zoom as cookies and
then trying to load them. the cookies are storing fine, and also being
called correctly.
however, for some reason,. the map will NOT load the center properly.
here is some of the code...
//CREATE map
var map = new GMap2(document.getElementById('map'));
//SETS LOCATION COOKIES
GEvent.addListener(map, "moveend", function() {
var center = map.getCenter();
var lat = center.lat();
createCookie('cookie_lat',lat,1);
var lng = center.lng();
createCookie('cookie_lng',lng,1);
var zoom = map.getZoom();
createCookie('cookie_zoom',zoom,1);
});
//LOADS MAP BASED ON LOCATION COOKIES
var zoom_load = readCookie('cookie_zoom');
var lat_load = readCookie('cookie_lat');
var lng_load = readCookie('cookie_lng');
if((typeof(lat_load)!='undefined')&&(typeof(lng_load)!
='undefined')&&(typeof(zoom_load)!='undefined'))
{
alert('['+zoom_load+']');
alert('['+lat_load+']');
alert('['+lng_load+']');
map.setCenter(new GLatLng(lat_load, lng_load), zoom_load);
}
here is the link to the map
http://www.riversurfing.ca/v2/map.php
any help would be great!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---