Home › Forums › MapPress Support › mapp0_zoommarker
- This topic has 6 replies, 3 voices, and was last updated 10 years, 8 months ago by
Chris.
-
AuthorPosts
-
July 10, 2012 at 8:10 pm #9881
Can we display a Zoom link to the finished map – like the one we see when setting up the map on the admin side. But in the info box for website users to see and use to zoom in on that location?
July 11, 2012 at 5:09 am #9888Yes, it’s actually part of 2.38.3 beta – why don’t you give that version a try and see if it works for you? If not there’s a javascript function you can call for the same effect.
July 11, 2012 at 8:01 am #9889Thank you
I will try the beta……..
if that does not work can you point me in the direction of the js fix please.July 13, 2012 at 11:07 am #9907Hi Chris,
Can you please let me know how to call the zoom function with js.
July 13, 2012 at 11:27 am #9908The javascript function is only available in the beta.
This will zoom in on a POI by index number. 0 is the first POI on the map, 1 is the second, and so on:
<a href='#' onclick='mapp0.getPoi(0).zoomIn(); return false;' >$text</a>
You can also read the POIs by postid:
mapp0.getPoiById(1234);
Note that ‘mapp0’ is the default name for the first displayed map. See the FAQ for info about how to choose another name.
If you want to open the POI first, use:
mapp0.getPoi(0).open(true);
The ‘true’ value means to open the POI and show its viewport (for example, for a city the plugin will show the entire city). ‘false’ means don’t zoom, and a number will zoom the map to that zoom level (0-15).
Both the open and zoom link are available in PHP. If you have a poi object you can use:
echo $poi->get_open_link();
echo $poi->get_zoom_link();
You can see the file ‘mappress_poi.php’ for the code for those functions.
July 18, 2012 at 10:18 am #9946Hi Chris,
Right now when I use the ‘zoom’ function, the poi is centered and the info window opens up. But often the info window is partially skewed (at least in my map). How can the zoom function work so that the info window is completely visible?
I like how prezoom the info window opens and the map moves itself so that the info window is completely visible. It would be great to include this in the next beta version.
http://dev.fresnohousing.org/about/properties/
Doug
July 19, 2012 at 1:46 am #9955Hi ftadoug:
I know what you mean. The reason is that when zooming, the map has to be exactly centered on the poi, otherwise it would zoom in on the wrong location. If the map’s not tall enough, the infowindow may not be fully visible.
I’m not sure if it will help, but one workaround is to just make your map slightly taller so there’s room for the full infowindow.
I’ll see if there’s anything I can do in the plugin. I tried to center, zoom, and then open the infowindow, but then the map seems to jump around a lot, rather than having the effect of smoothly zooming on a point.
Google probably came to the same conclusion – maps.google.com works exactly the same way if you shrink the window a bit.
-
AuthorPosts
- You must be logged in to reply to this topic.