Nick_SD
asked on
Can I zoom in on a google map marker
I have a page which loads up 20 markers into a google map
http://offers.ftvdirect.co.uk/list.asp
I would like to zoom in on the map when the user clicks on the left hand side markers
has anybody got any code which will let me do this
thanks
http://offers.ftvdirect.co.uk/list.asp
I would like to zoom in on the map when the user clicks on the left hand side markers
has anybody got any code which will let me do this
thanks
ASKER
I was really wanting the map marker to show the bubble and centre on it when selecting the corresponding letter
Can this be done ?
Can this be done ?
I'm speaking only on theory here, I haven't tried this myself. I think its possible with setCenter.
I assume you already know the geo location of the pointer, so simply call setCenter with that position and the zoom level you want.
I assume you already know the geo location of the pointer, so simply call setCenter with that position and the zoom level you want.
map.setCenter(new GLatLng(lat, lon), 10);
ASKER
the mapcentering appears to get rid of existing markers on the map
and simply create a new one.
and simply create a new one.
ASKER
@leakim971 the markers are off the map , the sample you sent was on map (i think)
line 347 to 349 replace :
GEvent.addListener(marker, 'click', function () {
marker.openInfoWindowHtml(locdesc);
});
by : GEvent.addListener(marker, 'click', function () {
map.setCenter(marker.getLatLng(), 14); // 14 is the zoom
marker.openInfoWindowHtml(locdesc);
});
leakim971-486572.flv
ASKER
thanks but this is "in map clicking" ,it looks great but need this to happen from a click outside the map take a look at this link http://offers.ftvdirect.co.uk/list.asp
you will see what i mean , links on the left outside the map.
im sorry if im missing the obvious here. If I can call the function from outside the map can you show me what im missing
you will see what i mean , links on the left outside the map.
im sorry if im missing the obvious here. If I can call the function from outside the map can you show me what im missing
ASKER
yes when the user click on "A" inside the map it centers and shows the box, (thanks for that)
my initial request was when the user clicks on the left hand side markers (out of map)
the map zooms into that marker
can this be done or am i missing the point?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
great thanks
yes thats superb , anyway to popup the info box on the marker or am i asking too much
yes thats superb , anyway to popup the info box on the marker or am i asking too much
not with your current code because your sidebar and markers are currently in different world
Check this example to see if it help you rebuild your page :
https://www.experts-exchange.com/questions/27107049/Google-Maps-Route-description-from-multiple-markers-Javascript-Drawing-polyline.html?cid=1131&anchorAnswerId=35999654#a35999654
Check this example to see if it help you rebuild your page :
https://www.experts-exchange.com/questions/27107049/Google-Maps-Route-description-from-multiple-markers-Javascript-Drawing-polyline.html?cid=1131&anchorAnswerId=35999654#a35999654
ASKER
ok thanks for that, Im not sure why on earth they make this so complicated
Nick
Nick
http://code.google.com/apis/maps/documentation/javascript/v2/reference.html#GMap2.setCenter