jQuery UI IE7嵌套无序列表错误

时间:2010-09-24 22:03:25

标签: jquery-ui nested jquery-ui-sortable

我正在努力让每个子列表只能在其组中进行排序。 这在FF中完美运行,但在IE中它可以移动整个父项,或者使用e.stopPropagation();完全杀死子项中的功能。我需要在孩子身上保持活力。

建议?

$(document).ready(function() {

    $("#sortable2").sortable({
       opacity: 0.5,
       stop:function(i){
       $.ajax({
            type: "GET",
            url: "?",
            data: $(this).sortable("serialize")
       });
       }
    });


 $("#sortable2").selectable();
 $("#sortable2").disableSelection();

 $('#sortable2 ul').bind('mousedown', function(e) {
    e.stopPropagation();
 });

});

HTML:

<ul id="sortable2">
    <li>One</li>
    <li>Two</li>
    <li>Three
        <ul id="sortable2">
            <li>One-3</li>
            <li>Two-3</li>
        </ul>
    </li>
</ul>

1 个答案:

答案 0 :(得分:2)

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
    $(".sortable2").sortable({
       opacity: 0.5,
       stop:function(i){
       $.ajax({
            type: "GET",
            url: "?",
            data: $(this).sortable("serialize")
       });
       }
   }).bind('mousedown', function(e) {
       if ($.browser.msie) {
           e.stopPropagation();
       };
   });
});
</script>

<ul class="sortable2">
    <li>One</li>
    <li>Two</li>
    <li>Three
        <ul class="sortable2">
            <li>One-3</li>
            <li>Two-3</li>
        </ul>
    </li>
</ul>

在IE6 / 7/8,Chrome,FF中测试。

相关问题