Hi
I have a lot of marker in my map
and each map have almost the same GEvent
this is my simple code in creating a marker ( i use js prototype ) :
function createmarker () {
GEvent.addListener(markerme, 'click', function() {
map.panTo(markerme.getPoint());
map.panDirection(0,0);
//calling class infowindow
map.openInfoWindow( ......)
GEvent.addListener(markerme,'infowindowopen',function() {
if($('editInfo')) {
GEvent.addDomListener($('editInfo'), 'click', function() {
//Calling class edit event
GEvent.trigger(markerme,'click');
});
}
if($('cancelInfo')) {
GEvent.addDomListener($('cancelInfo'), 'click', function() {
//calling class cancel info
GEvent.trigger(markerme,'click');
});
}
});
});
then i add it to the map
}
so when i click on the marker it will open the infowindow
on the first window there will be a html input button with id
"editInfo"
when i click the button I set the marker data to edit mode than
trigger marker "click" event again and this time the infowindow will
show the edit mode
the html input button "cancelInfo" will be there instead of "editInfo"
and when you click on it, it will set marker mode to show mode again
and trigger the "click" event
My Question:
because i call the click event every time does that mean i create a
duplicate of below function
- GEvent.addListener(markerme,'infowindowopen',function()
- GEvent.addDomListener($('editInfo'), 'click', function() {
- GEvent.addDomListener($('cancelInfo'), 'click', function() {
every time (redefine exactly same function)?
if it's duplicate then, is there any method to prevent this
like checking if the function exist than just pass it without define
it again
cause i have a lot of Dom Listerner there
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---