0

I have this function below but it does not work on iphone6:

$(document).on("click touch", "a[href^='#']", function (e) {
  var id = $(this).attr("href");
  if ($(id).length > 0) {
    e.preventDefault();

    // trigger scroll
    scrollMagicController.scrollTo(id);

      // if supported by the browser we can even update the URL.
    if (window.history && window.history.pushState) {
      history.pushState("", document.title, id);
    }
  }
});

I have tried vclick:

$(document).on("vclick"...

But it still does not work.

Any ideas?

Run
  • 54,938
  • 169
  • 450
  • 748

1 Answers1

0

I think there is no "touch" use "tap"

$(document).on("click tap", "a[href^='#']", function (e) {
  var id = $(this).attr("href");
  if ($(id).length > 0) {
    e.preventDefault();

    // trigger scroll
    scrollMagicController.scrollTo(id);

      // if supported by the browser we can even update the URL.
    if (window.history && window.history.pushState) {
      history.pushState("", document.title, id);
    }
  }
});
enno.void
  • 6,242
  • 4
  • 25
  • 42