I'm building a page with a lot of PNGs being animated by jQuery. Everything was fine up until yesterday, when I noticed that the page would crash in Chrome if I left it open for 开发者_如何转开发a few minutes. This doesn't always happen, and I haven't had it happen yet in Firefox, Safari or IE9. I've never built anything on this scale before, so I'm not sure where to even start looking.
I'm using jQuery 1.6.1, jQuery scrollTo 1.4.2, and the jQuery UI slider 1.8.16.
You can see the page here, and my javascript here.
Turns out it was my use of setInterval() to loop animations that was causing the problem. I'm not sure about the details, but replacing all the instances of setInterval() with recursive functions using setTimeout() -- that also checked to make sure the animation wasn't already running -- solved the problem.
精彩评论