简体   繁体   English

jQuery雪花插件在iOS5上崩溃

[英]jQuery snowflake plugin crashing on iOS5

I'm using the jQuery snowflake plugin found here: https://github.com/loktar00/JQuery-Snowfall 我正在使用在这里找到的jQuery雪花插件: 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. 在Safari低于5.0的iOS设备上,Safari可以正常工作,但在装有iOS5的设备(iPad和iPhone)上,大约20秒后,Safari将在带有插件的页面上崩溃。 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? 您是在Mobile Safari还是具有Web视图的本机应用程序中运行它? 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. iOS中关于JavaScript的内存和脚本大小有限制,但是您建议20秒后崩溃的事实可能表明您正在遇到这种情况。

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). 我已经尝试过从您在运行iOS 5的第一代iPad上提供的链接运行示例页面,它根本不会崩溃(运行了几分钟)。 Performance seems quite good given the hardware - and the debug console for Mobile Safari shows no problems. 考虑到硬件,性能似乎非常好-Mobile Safari的调试控制台没有问题。 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). 我建议您要么尝试更多的设备以获取良好的样本量,要么查看问题是否可能在其他地方(也许在您要添加效果的页面上)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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