Switching to different POIs on map from article

Home Forums MapPress Support Switching to different POIs on map from article

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #12620
    robertskiba
    Participant

      Hi Guys,

      I have a Map at the bottom of an article in WordPress with 4 POIS. In the text-area of the article I want to make an ordered List with the names of the 4 POIs that are clickable and if the user clicks on one of the names the POI on the map should be centered.

      Is this possible with mappress pro??

      Greetings

      robert

      #12625
      Chris
      Keymaster

        Hi Robert,

        There’s a function called get_open_link() in ‘mappress_poi.php’ that does something similar.

        You can take a look at that code, or try adding javascript like this to whatever element you want to be clickable (an anchor, div, etc. – the code below is for an anchor):

        <a href='#' onclick='mapp0.getPoi(0).open(true); return false;'>Click me!</a>

        ‘mapp0’ means the first map on the page, you can also use the “name” parameter of the shortcode to assign a different name. getPoi(0) means get the first POI, getPoi(1) is the 2nd, and so on. And .open(true) means open and zoom in – set to false to just open the marker.

        #12628
        robertskiba
        Participant

          Thank you, works perfect. But it can be quite hard to get the POI-Numbers if you have many POIs because they don’t correlate to the listing when you edit them. Is there a trick?

          #12631
          Chris
          Keymaster

            Hi,

            If it is a mashup you’re displaying, you can use getPoiById() instead, and pass it the post ID you want (1234 in this example):

            mapp0.getPoiById(1234).open(true);

            If you’re displaying a map, the POIs are numbered in the order they appear on the map: 0, 1, 2…and so on.

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.