2011-01-19 70 views
0

我有我自己的两个jQuery插件,并通过这两个插件创建的元素都有自己的的z-index值 .Eg:是否可以在两个JQuery插件之间传递数据?

// 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

尝试使用名字空间

用于例如,在插件1 可以定义

var Plugin1 = {}; //data abuot the plugin 
Plugin1.element1 = {}; //data about the element 
Plugin1.element1.zindex = 1000; //data about the element 

这可以在js 的任何部分进行检索,但要确保其之前定义的document.ready

相关问题