On Jan 29, 6:49 am, drtowery <[email protected]> wrote: > ok, this is what I've got now...everything still loads, but clicking > the markers still doesnt do anything, did I do it incorrectly?
I would think you would want to define the marker "click" handler inside the createMarker function, rather than creating additional markers. Like this: http://www.geocodezip.com/sappbrosts_dontesting_map2a.html -- Larry > > function markerZoom() { > var marker = new GMarker(point, gicons[icontype]); > GEvent.addListener(marker, "click", function() { > map.setCenter(marker.getLatLng(),(map.getZoom()+2)); > }); > > } > > var map; > > function load() { > if (GBrowserIsCompatible()) { > map = new GMap2(document.getElementById("map")); > > On Jan 28, 6:41 pm, "[email protected]" <[email protected]> > wrote: > > > > > On Jan 28, 2:02 pm, drtowery <[email protected]> wrote: > > > > is this close to what I'm looking for? > > > > function setZoom(level) { > > > GEvent.addListener(marker, "click", function() { > > > marker.setZoom(level); > > > }); > > > > } > > > > Does this " marker.setZoom" need to be marker.setZoom, or map.setZoom? > > > The setZoom function is a function of the GMap2 object. So it should > > be the map. > > You may want to "center and zoom in" on the marker > > > map.setCenter(marker.getLatLng(),(map.getZoom()+2)); > > > But your map variable needs to be global (it is currently local to > > your load function). > > > Change var map = ... > > to map = ... > > > put "var map;" just before your load function. > > See Mike Williams' tutorial for a discussion of variable scope if you > > are interested in why you need to do > > that:http://www.econym.org.uk/gmap/scope.htm > > > -- Larry > > > > On Jan 28, 3:46 pm, drtowery <[email protected]> wrote: > > > > >http://www.sappbrosts.com/dontesting/map/map2.html > > > > > On Jan 28, 3:45 pm, drtowery <[email protected]> wrote: > > > > > > yea, i've seen all the documentation, but I dont know how to code in > > > > > javascript so it really doesnt mean anything to me. this "setZoom > > > > > (level:Number) " means nothing to me because I dont know where to > > > > > place this in the script in conjunction with the listener. Thats why > > > > > i was looking for code that was already done so I could use it as a > > > > > guide. Unfortunately, there are no examples in the documentation that > > > > > actually show you how to use the code which is why I am here looking > > > > > for help. > > > > > > On Jan 28, 3:36 pm, "[email protected]" <[email protected]> > > > > > wrote: > > > > > > > On Jan 28, 1:32 pm, drtowery <[email protected]> wrote: > > > > > > > > I've been searching the internet for the code, some has had to > > > > > > > have > > > > > > > done it before. I saw a side bar with links earlier that would > > > > > > > zoom > > > > > > > in when the link was clicked, but I lost the page and havent been > > > > > > > able > > > > > > > to find it again. > > > > > > > Might I suggest the documentation? > > > > > > A combination of these functions should allow you to achieve your > > > > > > desired > > > > > > result:http://code.google.com/apis/maps/documentation/reference.html#GMap2.g...... > > > > > > > or perhaps even: > > > > > > map.zoomIn(); > > > > > > map.zoomIn(); > > > > > > > -- Larry > > > > > > > > On Jan 28, 3:30 pm, drtowery <[email protected]> wrote: > > > > > > > > > I want it to zoom in 2 levels when a user single clicks on a > > > > > > > > marker.- Hide quoted text - > > > > > > > - Show quoted text -- Hide quoted text - > > > > > > - Show quoted text -- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
