문제

I have the following script code designed to capture double tap events so I can toggle an image between a size that fits on the page and full size. The problem is that the tap event is not firing at all in Safari browser running on iPhone 4. In the below code, the alert never displays regardless of what I do on the touch screen.

$(function () {
  $('#showImage').on('tap', function (event) {
    alert("gets in tap event");
    var d = new Date();
    var tapTime = d.getTime();
    if (tapTime - lastTapTime > 500) {
      lastTapTime = tapTime;
    }
    else {

      toggleResize();

    }
  });
});

Why isn't this working?

도움이 되었습니까?

해결책

tap event is now working. I had some script code on an earlier page that was breaking the script code on this page. When I removed the earlier script code, this script code started working again.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top