From: Jan Schneider Date: Mon, 16 Mar 2009 17:19:11 +0000 (+0100) Subject: Add option to set a parent element for the dragger. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=bd978615d2341bb33852098834b3f74ef961ccab;p=horde.git Add option to set a parent element for the dragger. --- diff --git a/imp/js/src/dragdrop.js b/imp/js/src/dragdrop.js index 2839bc788..8d392d0ab 100644 --- a/imp/js/src/dragdrop.js +++ b/imp/js/src/dragdrop.js @@ -177,6 +177,7 @@ Drag = Class.create({ this.options = Object.extend({ caption: '', classname: 'drag', + parentElement: null, constraint: null, ghosting: false, scroll: null, @@ -240,7 +241,11 @@ Drag = Class.create({ oleft = this.element.offsetLeft; otop = this.element.offsetTop; this.ghost = $(this.element.cloneNode(true)).writeAttribute('id', null).setOpacity(0.7).clonePosition(this.element, { setLeft: false, setTop: false }).setStyle({ left: oleft + 'px', position: 'absolute', top: otop + 'px', zIndex: parseInt(this.element.getStyle('zIndex')) + 1 }); - this.element.insert({ before: this.ghost }); + if (this.options.parentElement) { + this.options.parentElement().insert(this.ghost); + } else { + this.element.insert({ before: this.ghost }); + } vo = this.ghost.cumulativeOffset(); this.ghostOffset = [ vo[0] - oleft, vo[1] - otop ]; }