Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css jQueryUI1.9.2上可拖动div的stack选项重置元素z索引_Css_Jquery Ui_Z Index_Draggable_Jsplumb - Fatal编程技术网

Css jQueryUI1.9.2上可拖动div的stack选项重置元素z索引

Css jQueryUI1.9.2上可拖动div的stack选项重置元素z索引,css,jquery-ui,z-index,draggable,jsplumb,Css,Jquery Ui,Z Index,Draggable,Jsplumb,我有几个div(dinamically生成),它们的z索引在css中设置为120: .plugin { position: absolute; z-index: 120; } 它们包含标题(位于顶部)和画布: .plugin_title { font-size: 13px; color: rgba(255, 255, 255, 0.9); font-family: arial; backgr

我有几个div(dinamically生成),它们的z索引在css中设置为120:

.plugin {
        position: absolute;
        z-index: 120;
    }
它们包含标题(位于顶部)和画布:

.plugin_title {
        font-size: 13px;
        color: rgba(255, 255, 255, 0.9);
        font-family: arial;
        background-color: #300;
        z-index: 150;
    }
.plugin_canvas {
        position: relative;
        background-color: black;
        border: 1px solid #300;
        border-bottom-right-radius: 5px;
        z-index: 120;
    }
当我创建它们时,我会:

var div = $( '<div class="plugin ' + audioclass + '" id="'+ id + '"</div>').width(width + 2).height(height + 2);
var ctx = $( '<canvas class="plugin_canvas" width="' + width + '" height="'+ height + '" />', {width: width, height: height} );
var title = $( '<div class="plugin_title"> ' +name + ' </div>');
title.appendTo(div);
ctx.appendTo(div);
div.appendTo('#plugin_area');
问题是,当我拖动其中一个.plugin div时,它的z索引被重置为1(并且每次拖动它时都会增加,因为
stack
选项)。相反,我希望z-index从120开始(对于.plugin divs的原始z-index值),并从该值开始递增

jqueryui 1.7为
堆栈
选项提供了一个
min
参数。在jqueryui 1.9.2(我正在使用的版本)中,您只能指定一个选择器,并且,我可以从中理解,堆叠应该从元素的预先存在的z索引开始。相反,它似乎任意地从1开始。我错过了什么

(jsplumb:1.3.16,jqueryui:1.9.2,jquery:1.8.1。请注意,我无法回滚到较旧版本的jquery ui)

使用

$(".plugin").each(function() {
            // always use a radix when using parseInt
            var index_current = parseInt($(this).css("zIndex"), 10);
            if((20 - index_current) > 0) {
                $(this).css("zIndex", 20 + index_current);
            }
        });
jqueryUI中也报告并修复了bug

$(".plugin").each(function() {
            // always use a radix when using parseInt
            var index_current = parseInt($(this).css("zIndex"), 10);
            if((20 - index_current) > 0) {
                $(this).css("zIndex", 20 + index_current);
            }
        });