简体   繁体   中英

jQuery snowflake plugin crashing on iOS5

I'm using the jQuery snowflake plugin found here: https://github.com/loktar00/JQuery-Snowfall

It works fine in Safari on iOS devices older than 5.0, but on devices with iOS5 (iPad and iPhone), Safari will crash on a page that has the plugin after about 20 seconds. Here are my default values for the plugin:

                    $('#content').snowfall({
                        flakeCount : 40,
                        flakeColor : '#ffffff',
                        flakeIndex: 999999,
                        minSize : 1,
                        maxSize : 4,
                        minSpeed : 2,
                        maxSpeed : 5
                    });

Any idea on how to fix it?

Thanks!

Are you running this in Mobile Safari, or in a native app with a web view? There are limits within iOS regarding memory and script size for JavaScript, but and the fact you suggest it crashes after 20 seconds could be an indication you're running into this.

I've tried running the sample page from the link you gave on a first-generation iPad running iOS 5, and it doesn't crash at all (for the couple of minutes I ran it for). Performance seems quite good given the hardware - and the debug console for Mobile Safari shows no problems. I'd suggest you maybe either try a few more devices to get a good sample size, or else see if the problem might be elsewhere (perhaps on the page you're trying to add the effect to).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM