Search code examples
javascripteventstouchdom-events

Touch Javascript event: user leaves finger on screen while new page loads


I have the following series of events:

The user presses an element on his touch screen. This causes a new page to load. The user does not lift his finger from the screen.

Now, I would like to register where his finger is on the new page (or where it is if he moves it). However, ontouchmove and ontouchstart only seem to fire if he lifts his finger and then touches the screen again.

Is there an event that fires?


Solution

  • I think the key is to use Ajax. That way new stuff can be loaded, but the touchmove event will continue to fire.

    I did not try this because I ended up, instead, loading everything to begin with and then handling everything in javascript. This way I never needed to reload the page. Of course, this only works with a basic page, but I'm guessing that ajax would work for pages that need server action.