Droppable - working with zIndex
Hi guys,
I needed change any things in Droppable UI because its don't have any
way to control what element that can be droppable based in z-Index
property.
The script that I created, check all elements droppable and drop only
in the element that have the major zIndex property.
In drop function change this line
if (!this.options.disabled && this.visible && $.ui.intersect
(draggable, this, this.options.tolerance))
to:
if (!this.options.disabled && this.visible && this.isover == 0)
in drag function change all function to:
drag: function(draggable, event) {
if(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets
(draggable, event);
var intersects = new Array();
var indice = new Array();
var i = 0;
$.each($.ui.ddmanager.droppables[draggable.options.scope], function
(e) {
if(this.options.disabled || this.greedyChild || !this.visible)
return;
if($.ui.intersect(draggable, this, this.options.tolerance)){
intersects[i] = this.zIndex;
indice[i] = e;
i++;
}
if(this.isover == 0){
this.isover = 1;
this.isout = 0;
this._out(this, event);
}
});
if(intersects.length){
var vMaior = intersects[0];
var indexX = indice[0];
for(i = 0; i < intersects.length; i++){if(vMaior < intersects[i])
{ vMaior = intersects[i]; indexX = indice[i];}}
$.ui.ddmanager.droppables[draggable.options.scope][indexX]._over
(vMaior, event);
setTimeout(function(){
$.ui.ddmanager.droppables[draggable.options.scope][indexX].isover
= 0;
$.ui.ddmanager.droppables[draggable.options.scope][indexX].isout =
1;
}, 1);
}
}
I hope I have helped.
Thanks