问题描述
我在HTML页面上有几千个按钮。准备文档时,需要超过10秒才能运行 $(。buttonset)。buttonset();
。有没有更快的方法来做到这一点,或者是我唯一的解决方案来限制按钮的数量?创建 buttonset
在第一次显示之前按需提供。
我刚刚测试了24个盒子,分为12个部分。它可以使用Chrome 23,Firefox 17,IE9,Opera 12在我的i7上顺利运行。
这可能会在您首次打开复选框组时添加拆分加载时刻,但它通过不创建未使用的样式按钮来保存一些内存,直到他们需要。
I have a few thousand buttons on an HTML page. It takes more than 10 seconds to run $(".buttonset").buttonset();
on document ready. Is there a faster way to do this, or is my only solution to somehow limit the number of buttons?
Create the buttonset
s on demand before they are shown by the first time.
I just tested with 2400 boxes split in 12 sections. It runs smoothly on my i7 using Chrome 23, Firefox 17, IE9, Opera 12.
This may add a split loading moment for the first time you open a a checkbox group, but it does save some RAM by not creating unused styled buttons until they're necessary.
这篇关于jQuery UI .buttonset()太慢了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!