我有两个自己的 jquery插件,两个插件创建的元素有自己的 z-index值 .E.g:
// 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值为所有元素的最大值我创建了。但现在 z-index 被分开了!
我正在使用 JQuery UI可拖动插件,但不喜欢堆栈选项!
非常感谢!!
答案 0 :(得分:0)
尝试使用名称空间
例如插件1 你可以定义
var Plugin1 = {}; //data abuot the plugin
Plugin1.element1 = {}; //data about the element
Plugin1.element1.zindex = 1000; //data about the element
这可以在js的任何部分中检索 但要确保在document.ready
之前定义它