Event Documentation

Home Forums MapPress Support Event Documentation

  • This topic has 2 replies, 1 voice, and was last updated 1 year ago by Chris.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #19358
    compassad
    Participant

      Hello,

      I’d like to have the Map List scroll to the selected item when it is clicked on the map, however I can’t figure out what to listen for, or how to add the listener. I think an event on popup open would work for my purposes.

      Is there any documentation on the events and how to add these listeners?

      Thanks!

       

      #19361
      Chris
      Keymaster

        Hi,

        I’m sorry, but there’s no JavaScript API or event available to expose the marker clicks for something like this.

        I can look into adding one for the next major release, but it’s a few months away.

        #19362
        compassad
        Participant

          Hi Chris,

          Thanks for the getting back to me. I ended up getting it to work by just adding my own click event listener to the markers themselves.

          
          $('.leaflet-marker-pane').on('click','.leaflet-data-marker', markerClicked );
          
          function markerClicked(){
          
          // set delay to allow selector to be updated
          setTimeout( function (){
          var item = document.querySelector('.mapp-item.mapp-selected');
          scrollInnerIntoView( item );
          }, 50);
          }
          
          #19364
          Chris
          Keymaster

            Great solution!  I was trying to think of an API event, and it didn’t even occur to me to use the elements on the page.

            Anyway, I’m glad you got it working, and thank you for sharing the answer.

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