问题描述
I'm using the Chosen jQuery widget from http://harvesthq.github.com/chosen/. It works well in my application in most browsers but it will not work in IE8 under 'Compatibility View'. This presents a problem for me because on my company's intranet Compatibility View is default for intranet sites. You can test my issue by going to the link above and switching to Compatibility View in IE.
我没有完全放弃的原因是因为在此页面上 http: //davidwalsh.name/dw-content/jquery-chosen.php 有人让它可以在IE的兼容性视图"中工作(自己动手看).
The reason I haven't completely given up on it is because on this page http://davidwalsh.name/dw-content/jquery-chosen.php someone gets it to work in Compatibility View in IE (see for yourself).
我正在使用jQuery 1.6.2和选择的0.9.5. Windows XP和IE 8.0.6001的兼容性视图"下.如果我在开发工具中将浏览器模式切换为IE8,则效果很好,但我不希望每个用户都必须这样做.以前有没有人使用过此插件,并使其能够在IE8的兼容模式下工作?
I'm using jQuery 1.6.2 and the Chosen 0.9.5. Windows XP and IE 8.0.6001 under Compatibility View. It works fine if I switch the Browser Mode to IE8 in Dev tools but I don't want every user to have to do that. Has anyone used this plugin before and got it to work under Compatibility Mode in IE8?
<script type="text/javascript"> $("#groupsList").data("placeholder", "Select Groups").chosen();</script>
推荐答案
您知道一些事,今天我遇到了完全相同的问题.
You know something, I came across the exact same issue today.
David Walsh用于演示的版本是0.9.1. 0.9.5中有一段代码完全针对MSIE 7及更低版本禁用了它:
The version that David Walsh is using doing a demo of is 0.9.1. There's a piece of code in 0.9.5 that completely disables it for MSIE 7 and lower:
if ($.browser.msie && ($.browser.version === "6.0" || $.browser.version === "7.0")) {
return this;
}
我不完全了解IE在兼容模式下的作用-至少在具有兼容模式的IE9中,执行$.browser.version
返回7.0.这将导致此插件退出.
I don't exactly know what IE does in compatibility mode - in IE9 with compat mode, at least, doing $.browser.version
returns '7.0'. That'll cause this plugin to just exit.
如果您确实需要,可以禁用该检查或应用某人在此 github问题上建议的代码更改.或者,您可以只使用David演示中的0.9.1版本.
If you really wanted, you could disable that check or apply the code change that someone suggested on this github issue. Alternately, you could just use version 0.9.1 as from David's demo.
这篇关于选择的jQuery小部件在IE8的兼容性视图中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!