Javascript IE9&;jQuery:排序列表项在现代浏览器和IE7中有效,但在IE9中无效。

Javascript IE9&;jQuery:排序列表项在现代浏览器和IE7中有效,但在IE9中无效。,javascript,jquery,internet-explorer,jquery-ui,internet-explorer-9,Javascript,Jquery,Internet Explorer,Jquery Ui,Internet Explorer 9,我不太清楚这里发生了什么。它在IE9中不起作用。也许IE9不能正确处理JavaScript? 适用于Chrome、FF、Safari和IE7(我实际上已经测试过这些) 下面是我的代码: 不太复杂,只是嵌套排序。发生了什么事? 我需要为IE9做些特别的事情吗 所讨论的javascript: $j = jQuery.noConflict(); $j(function() { // these parts are here due to a z-index bug with IE $j('

我不太清楚这里发生了什么。它在IE9中不起作用。也许IE9不能正确处理JavaScript? 适用于Chrome、FF、Safari和IE7(我实际上已经测试过这些)

下面是我的代码:

不太复杂,只是嵌套排序。发生了什么事? 我需要为IE9做些特别的事情吗

所讨论的javascript:

$j = jQuery.noConflict();
$j(function() {

 // these parts are here due to a z-index bug with IE
    $j('ul').bind('mousedown', function(e) {
        e.stopPropagation();
        if ($j.browser.msie && $j.browser.version < '9.0') $j(this).closest('.section').css('z-index', '5000');
    });
    if ($j.browser.msie && $j.browser.version < '9.0') {
        $j('ul').bind('mouseup', function(e) {
            $j(this).closest('.section').css('z-index', '1000');
        });
    }
// the actual sorting code / jqueryUI sorting
    $j("#sort_content_41,#sort_content_40,#sort_content_42,#sort_content_39").sortable({
        connectWith: '.section-content',
        dropOnEmpty: true,
        zIndex: 1004,
        cursor: 'crosshair'
    });
    $j("#sort_sections").sortable({
        placeholder: "ui-state-highlight",
        connectWith: '.sections',
        axis: 'y',
        zIndex: 1003,
        cursor: 'crosshair'
    });
});

$j(function() {
    $j("section-content").sortable({
        connectWith: "section-content",
        dropOnEmpty: true
    });
    $j(".section-content").disableSelection();
});
$j=jQuery.noConflict();
$j(函数(){
//这些部件出现在这里是由于IE的z索引错误
$j('ul').bind('mousedown',函数(e){
e、 停止传播();
如果($j.browser.msie&&$j.browser.version<'9.0')$j(this).closest('.section').css('z-index','5000');
});
如果($j.browser.msie&&$j.browser.version<'9.0'){
$j('ul').bind('mouseup',函数(e){
$j(this).最近('.section').css('z-index','1000');
});
}
//实际排序代码/jqueryUI排序
$j(“#sort_content_41,#sort_content_40,#sort_content_42,#sort_content_39”)。可排序({
连接方式:'.section content',
真的,
zIndex:1004,
光标:“十字线”
});
$j(“#排序_节”)。可排序({
占位符:“ui状态突出显示”,
连接到:'.sections',
轴:‘y’,
zIndex:1003,
光标:“十字线”
});
});
$j(函数(){
$j(“节内容”)。可排序({
连接:“节内容”,
真的吗
});
$j(“.section content”).disableSelection();
});

解决方案是将jQuery更新到最新版本。旧版本在IE9下无法正常工作。

对于那些由于某种原因无法将jQuery升级到最新版本的人,有一些用于拖放鼠标交互的热修复程序

请参阅以下链接:

我也遇到过类似的问题。我已经通过在ui.core.js的末尾添加以下代码修复了这个问题

(function ($) {
    var a = $.ui.mouse._mouseMove;
    $.ui.mouse._mouseMove = function (b) {
        if ($.browser.msie && document.documentMode >= 9) {
            b.button = 1
        };
        a.apply(this, [b]);
   }
}(jQuery));

将jQuery更新至最新版本。谢谢!那太好了,因为我一直想永远这么做。。。但在现实世界中,不可能总是有很好的借口=D@duri,如果你能给出答案,我可以给你打分=D