Tyler Biscoe
Tyler Biscoe

Reputation: 2422

Why wont a setTimeout fire in touchend handler after the user scrolls (iOS Safari)

For some reason a setTimeout will not fire in a touchend event handler if the user scrolls prior to the touchend event being fired. If the user does not scroll then the setTimeout fires as expected. This seems to be a problem with iOS version 6.0, and potentially not a problem in version 6.1.

Open this link on your iOS device/simulator to see the example:

Press anywhere on the page WITHOUT SCROLLING and release. The page will turn green as it's supposed to.

Then, press anywhere on the page, scroll, and release and the page will not turn green.

http://jsbin.com/aWamaHu/8

Open this link to see the code

http://jsbin.com/aWamaHu/8/edit

Upvotes: 0

Views: 460

Answers (1)

Tyler Biscoe
Tyler Biscoe

Reputation: 2422

I found the answer. Apparently, in iOS 6 and below all javascript is suspended while the user scrolls.

See here for more information:

iOS 6 js events function not called if has setTimeout in it

Upvotes: 1

Related Questions