diff options
author | Adrian Lang <lang@cosmocode.de> | 2010-03-02 14:30:37 +0100 |
---|---|---|
committer | Adrian Lang <lang@cosmocode.de> | 2010-03-02 14:31:09 +0100 |
commit | 63de0a583d1ce8c88c5362eecd0fc5ecd8c411a4 (patch) | |
tree | bcd5a74dca76c7cc600ae8d20a865d283ca30d62 /lib/scripts/drag.js | |
parent | 1410ed4b6ef86f5fcd267682eae03c9aece3346f (diff) | |
download | dokuwiki-63de0a583d1ce8c88c5362eecd0fc5ecd8c411a4.tar.gz dokuwiki-63de0a583d1ce8c88c5362eecd0fc5ecd8c411a4.zip |
Fix pageX and pageY in IE’s JS events
Diffstat (limited to 'lib/scripts/drag.js')
-rw-r--r-- | lib/scripts/drag.js | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/lib/scripts/drag.js b/lib/scripts/drag.js index fa249a996..254eab4a6 100644 --- a/lib/scripts/drag.js +++ b/lib/scripts/drag.js @@ -50,8 +50,8 @@ var drag = { this.oX = parseInt(this.obj.style.left); this.oY = parseInt(this.obj.style.top); - this.eX = drag.evX(e); - this.eY = drag.evY(e); + this.eX = e.pageX; + this.eY = e.pageY; var _this = this; this.mousehandlers = [function (e) {return _this.drag(e);}, function (e) {return _this.stop(e);}]; @@ -80,23 +80,9 @@ var drag = { */ drag: function(e) { if(this.obj) { - this.obj.style.top = (this.evY(e)+this.oY-this.eY+'px'); - this.obj.style.left = (this.evX(e)+this.oX-this.eX+'px'); + this.obj.style.top = (e.pageY+this.oY-this.eY+'px'); + this.obj.style.left = (e.pageX+this.oX-this.eX+'px'); } }, - /** - * Returns the X position of the given event. - */ - evX: function(e){ - return (e.pageX) ? e.pageX : e.clientX + document.body.scrollTop; //fixme shouldn't this be scrollLeft? - }, - - /** - * Returns the Y position of the given event. - */ - evY: function(e){ - return (e.pageY) ? e.pageY : e.clientY + document.body.scrollTop; - } - }; |