Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Those of you familiar with the Popup version of InfoWindow in ESRI's JavaScript API know that the Popup has a 'Zoom To' link on it that zooms you 4 levels closer to the linked feature. I'd like to fire another event after the default zoom to function executes. Here is the link in the HTML.

<div class="actionsPane">
  <div class="actionList">
    <a class="action zoomTo" href="javascript:void(0);">Zoom to</a>
  </div>
</div>

I'm able to add a function to the Zoom To click with jQuery like this:

$('.action.zoomTo').click(function() {alert('Clicked!');});

But the the function above occurs before the default function of 'Zoom To'. I wouldn't mind their click function executing, so long as it fires after mine does.

Any ideas?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

You can disconnect the ESRI Zoom To function like this:

dojo.disconnect(map.infoWindow._eventConnections[4]);

This assume your var map = esri.Map(). The the fifth element in the _eventConnections array is the zoom to event.

Then you can attach your own events to the Zoom To with jQuery or dojo:

// Add custom zoom To
$('.action.zoomTo').click(function () { alert('First!'); });
$('.action.zoomTo').click(function () { alert('Second!'); });

It appears that the new connection can only be made after the an InfoTemplate is instantiated.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.