可以在两个JQuery插件之间传递数据吗?

可以在两个JQuery插件之间传递数据吗?,jquery,draggable,z-index,Jquery,Draggable,Z Index,我有两个自己的jquery插件,由这两个插件创建的元素有自己的z-index值。例如: // auto increase the z-index value // auto increase the z-index to the maximum of their own when I drag it. element1 created by plugin1 and has the z-index:1; element2 created by plugin1 and has the z-ind

我有两个自己的jquery插件,由这两个插件创建的元素有自己的z-index值。例如:

// auto increase the z-index value 
// auto increase the z-index to the maximum of their own when I drag it.

element1 created by plugin1 and has the z-index:1;
element2 created by plugin1 and has the z-index:2;
....

// auto increase the z-index value 
// auto increase the z-index to the maximum of their own when I drag it.

element2 created by plugin2 and has the z-index:1;
element2 created by plugin2 and has the z-index:2;
.....
这两个元素都可以拖动,所以当我点击其中一个时,我希望它的z-index值是我创建的所有元素的最大值

我正在使用JQuery UI可拖动插件,但不喜欢堆栈选项

非常感谢

尝试使用名称空间

对于插件1中的eg 你可以定义

var Plugin1 = {}; //data abuot the plugin
Plugin1.element1 = {}; //data about the element
Plugin1.element1.zindex = 1000; //data about the element
这可以在js的任何部分检索 但请确保在document.ready之前定义它