1 Reply
      Latest reply on Sep 26, 2019 12:24 PM by Hoshi
      Hoshi Level 1 Level 1 (0 points)

        Hello,

         

        mapkit js doesn't seem to get a lot of traction on the forum. Is this the right place to talk about it?

        Anyway, I am facing something very weird and I'd like to share it to try to find a solution. I am developing a website using mapkit js. I need to perform a certain action on the click (or tap) event. It works perfectly on desktop (safari, chrome and firefox), but somehow the click event doesn't fire on iphone or ipad (with safari and chrome).

         

        The code looks like that:

         

        map.element.addEventListener("click", function(event) {

          if (event.target.parentNode !== map.element) {

                 // This condition prevents clicks on controls. Binding to a 

                 // secondary click is another option to prevent conflict

          return;

             }

            alert("click on map");

          }); 

         

        The double tap is triggering a zoom, so the framework is catching the taps, but somehow the tap doesn't trigger the click (all other map framework I use do). Is this a normal behavior? Is there a way to make the tap work as a click, or to catch the tap event?

         

        Thank you for help!

        • Re: mapkit js mobile click
          Hoshi Level 1 Level 1 (0 points)

          Solution was by using the "single-tap" event which was released in version 5.18.0. Events documentation has not been updated since then and I only found out about it by reading all the release notes. Got lucky there