Raise Z-index on drag; moved draggable specific JS code to dragreg.js.
This commit is contained in:
parent
37138619c0
commit
a97cb237f2
9
plemp.rb
9
plemp.rb
|
@ -115,15 +115,8 @@ module Plemp::Views
|
||||||
else
|
else
|
||||||
span.draggable(:id => id, :style => default_style) { em "#{id}: Unsupported file type!" }
|
span.draggable(:id => id, :style => default_style) { em "#{id}: Unsupported file type!" }
|
||||||
end
|
end
|
||||||
script :type => "text/javascript" do
|
script(:type => "text/javascript") { "setup_draggable('#{id}')" }
|
||||||
<<-JS
|
|
||||||
new Draggable('#{id}', { scroll: window });
|
|
||||||
Draggables.addObserver(new DragRegObserver($('#{id}')));
|
|
||||||
$('#{id}').appear({duration: 2.0});
|
|
||||||
JS
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
span(:onClick => "alert(maxZIndex()); return false;" ) { "test" }
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,18 @@ DragRegObserver.prototype = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function maxZIndex() {
|
function new_ZIndex() {
|
||||||
return $$('.draggable').map(function(d) { return d.getStyle("z-index") }).max();
|
cur_index = $$('.draggable').map(function(d) { return d.getStyle("z-index") }).max();
|
||||||
|
return parseInt(cur_index) + 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function setup_draggable(id) {
|
||||||
|
drag = new Draggable(id, { scroll: window });
|
||||||
|
old_endeffect = drag.options.endeffect;
|
||||||
|
drag.options.endeffect = function(element) {
|
||||||
|
old_endeffect(element);
|
||||||
|
element.style.zIndex = new_ZIndex();
|
||||||
|
}
|
||||||
|
Draggables.addObserver(new DragRegObserver($(id)));
|
||||||
|
$(id).appear({duration: 2.0});
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue