Quote:
Originally Posted by jnwbbr
My issue right now is that within the handleBlogFeed() function, the variable "buzzMap" is undefined. I tried moving
Code:
var myOptions = {
zoom: 13,
center: startLatLng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var buzzMap = new google.maps.Map(document.getElementById("map_canvas"), myOps);
outside of the runStart() function to make it a global variable, but google didn't like that and threw some errors.
|
You can't access DOM objects before the DOM is actually loaded (or the maps API before it is loaded), so moving the whole thing out of that start handler (which presumably gets called after the DOM and the maps API are loaded) won't work.
What you can do, though, if you need those things to be globally accessible is to
declare those variables in the global scope (
var myOptions, buzzMap;) and actually
define them inside the start handler. Make sure you don't use the
var keyword there, though, because that would result in new local variables instead of changing the already existing global ones.