Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8691267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:05:22+00:00 2026-06-13T00:05:22+00:00

I noticed this strange behaviour with the latest iOS (iOS 6). If calling a

  • 0

I noticed this strange behaviour with the latest iOS (iOS 6). If calling a function for any touch event which has a setTimeout inside, the part inside the setTimeout is never triggered.

This happens only when there is a “system animation” such as scroll and zoom-in/out.

For example:

http://jsfiddle.net/p4SdL/2/

(I used jquery just for testing but the same happens with pure js)

Open that page with safari on any iOS 6 device and zoom in or out. The alert will never be called.

If tested on any iOS 5 device this will work just fine! It seems that during these animations the setTimeout or setInterval are reset by the OS. Is this the intended behaviour or a bug?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T00:05:24+00:00Added an answer on June 13, 2026 at 12:05 am

    Note: It looks like UIWebView does not support requestAnimationFrames. Thanks to Guillaume Gendre for pointing it out!

    We ran into a similar issue with a web app we’re working on.

    For us, it was touchmove that caused issues. We implemented a workaround (found here: https://gist.github.com/3755461) that seemed to work pretty well until another issue forced us to abandon it. (I tried adding the workaround to your fiddle and was able to get the timer to fire once or twice, but it required a weird gesture+scroll event that was damn near impossible to consistently reproduce.)

    Anyway, one of the new features in iOS 6 for developers are requestAnimationFrames. My workaround is basically a wrapper for timers, allowing the developer to pass a boolean, which will call either the native function or the workaround function.

    For example:

    setTimeout(function(){alert("HI")}, 1000); // using native
    setTimeout(function(){alert("HI")}, 1000, true); // using workaround
    

    Here are additional ways to use the workaround:

    setInterval(function(){console.log("Interval")}, 1000, true);
    
    var timer = setTimeout(function(){ /* ... */ }, 60000, true);
    clearTimeout(timer);
    
    var interval = setInterval(someFunc, 10000, true);
    if(someCondition) clearInterval(interval);
    

    Here are two fiddles with the workaround examples. Try pinch/zooming on the black squares:

    http://jsfiddle.net/xKh5m/embedded/result (Uses native setTimeout function)
    http://jsfiddle.net/ujxE3/embedded/result

    We’ve been using this workaround for a few months in a production environment, and have not run into any major issues.

    Here’s a public gist of the workaround: https://gist.github.com/4180482

    Here’s more information about requestAnimationFrames:

    MDN documentation

    Paul Irish on requestAnimationFrame

    Good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've noticed a strange behaviour of the live() function in jQuery: <a href=# id=normal>normal</a>
I noticed a strange behavior regarding keydown event in Chrome. I have this simple
I've noticed some very strange behaviour today in Code Igniter. I have this locations
I'm busy creating a page and noticed strange behaviour of a button inside a
I just noticed something strange. If I have this XML: <level number=7 background=background_5> and
I just recently noticed this behaviour. To put it shortly, it displays the commits
I am trying out the (latest) Android SDK, and noticed some strange behavior. I've
Lately I've noticed a strange behaviour in my browsers, when developing a website or
I have noticed a strange behaviour when intercepting the preUpdate row hook in Propel
I am creating a responsive website, and have just noticed a strange behaviour in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.