jQuery插件“选择"(增强mutliselects)在Chrome中效果很好,但在Internet Explorer中效果很差 [英] jQuery plugin Chosen (enhances mutliselects) works great in Chrome, but slow in Internet Explorer

查看:182
本文介绍了jQuery插件“选择"(增强mutliselects)在Chrome中效果很好,但在Internet Explorer中效果很差的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用选择jQuery插件. 在这里查看我的小提琴: http://jsfiddle.net/3XWSe/

I'm currently using the Chosen jQuery plugin. Check out my fiddle here: http://jsfiddle.net/3XWSe/

在Chrome和Internet Explorer(我已使用IE 11版进行了测试)中尝试摆弄.

Try the fiddle in both Chrome and Internet Explorer (I tested using IE version 11).

请注意,在Internet Explorer中单击多选按钮时存在延迟(4或5秒),而在Chrome浏览器中则只有很少(几乎没有).此示例下拉列表列出了德克萨斯州的所有城市,并且有将近5000个选项.

Notice there is a delay (4 or 5 seconds) when clicking on the multiselect in Internet Explorer, as compared to very little, almost none, in Chrome. This example dropdown is listing all the cities in Texas and has close to 5000 options.

我打开了 chosen.jquery.js 并跟踪了此调用的问题:

I opened up chosen.jquery.js and traced the problem to this call:

Chosen.prototype.update_results_content = function(content) {
    return this.search_results.html(content);  //<-- Problem here when loading the large amount of HTML into the element
};

我注意到,在第一次单击后,如果我停止对所有后续单击进行更新时,this.search_results.html,多选将不再缓慢响应.要解决第一次单击的问题,我可能需要以某种方式预加载内容.有什么想法吗?

I noticed that after the first click, if I stop this.search_results.html from updating on all subsequent clicks, the multiselect will no longer respond slowly. To fix the problem for the first click I would need to perhaps preload the content somehow. Any ideas?

关于如何解决IE的此性能问题的任何建议,还是您知道另一个可以处理IE中大量选项的可比jQuery插件? (我尝试了 select2 和其他一些方法都没有用).

Any suggestions on how to fix this performance issue for IE, or do you know of another comparable jQuery plugin that can handle these large amounts of options in IE? (I've tried select2 and some others to no avail).

编辑:由于这一问题在一年中变得越来越流行,所以我想让所有人都知道我放弃了选择,现在使用Select2 4.0(它具有出色的

Since this question has become popular over the year, I want to let everyone know that I abandoned Chosen and now use Select2 4.0 (which has excellent performance with large data and infinite scroll). It seems built to allow developers to decorate and alter it more easily and works on mobile.

推荐答案

由于这一问题在一年中变得很流行,所以我想让所有人都知道我放弃了选择,而现在使用的是 Select2 4.0 .

Since this question has become popular over the year, I want to let everyone know that I abandoned Chosen and now use Select2 4.0.

  1. 这似乎是选择最广泛接受的继任者.
  2. 4.0版本在具有大数据和无限滚动的情况下具有出色的性能.
  3. 似乎可以让开发人员更轻松地装饰和更改它.
  4. 它可以在移动设备上使用(不同于 Selectize ).
  1. It's seems to be the most widely accepted successor of Chosen.
  2. The 4.0 version has excellent performance with large data and infinite scroll.
  3. It seems built to allow developers to decorate and alter it more easily.
  4. It works on mobile (unlike Selectize).

这篇关于jQuery插件“选择"(增强mutliselects)在Chrome中效果很好,但在Internet Explorer中效果很差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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