This is v2.
Here's how to reproduce the problem:
- go to h开发者_如何学JAVAttp://tweetmyjobs.com/tweetmaps/24419/branded
- Click on the 'New Mexico' pin
- In the popup, click 'CLICK HERE'
- when zoomed in, clicking the middle pan control (aka 'return to last result') does nothing. I'd like to return to the state view... (with NM in the centre, or whatever position it was before zooming in)
Any idea where should I even start looking (yes, I am that clueless in this case).
The problem here is that you are navigating to a new page to show the zoomed in map - so according to the zoomed-in map, there is no 'last result' to go to.
What you need to do is bind an event to the 'Click here to zoom in' link's onclick event. If you use jQuery then you can simply do: $("#clickLinkId").click(function(e) { ... })
but if you're using conventional JavaScript then you can do the following to set up an event listener:
var link = document.getElementById("#clickLinkId");
link.onclick = function(e){ ... }
In whatever handler you have, you want to use the Google Maps API to set the map's centre location and zoom level to what it is you want. In all cases, you'd want to have something like e.preventDefault()
or return false
on the click's event handler so that it doesn't try to navigate the page away.
精彩评论