jQuery UI .buttonset()太慢了 [英] jQuery UI .buttonset() is too slow

查看:165
本文介绍了jQuery UI .buttonset()太慢了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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 buttonsets 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.

Fiddle

这篇关于jQuery UI .buttonset()太慢了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆